C++2 dimension vector
发布日期:2021-06-29 21:14:30
浏览次数:4
分类:技术文章
本文共 2147 字,大约阅读时间需要 7 分钟。
// ConsoleApplication12.cpp : This file contains the ‘main’ function. Program execution begins and ends there.
#include <stdlib.h> #include #include #include #include // std::pair #include // std::runtime_error #include // std::stringstream #include #include #include #include #include // std::stringstream #include using namespace std;int main()
{std::cout << "Hello World!\n";int count = 0;vectortest1;vector test3;//Open File and Count the number of filesfor (int i = 1; ; i++){ string a = "Experiment"; a = a + to_string(i); a = a + ".csv"; std::ifstream myFile(a); if (myFile.is_open()) { test1.push_back(a); cout << "Opened"; count = count + 1; } else { break; }}std::cout << count;for (int i = 0; i < 5; i++){ cout << test1[i];}//Find the largest Number among all files and stored in the numberOfRows vectorvector numberOfRows;string b;for (int i = 0; i < count; i++){ int temp = i + 1; b = "Experiment" + to_string(temp) + ".csv"; int rows = 0; ifstream file(b); string line; while (getline(file, line)) rows++; numberOfRows.push_back(rows);}//Print Them all for for (int i = 0; i < count; i++){ cout << numberOfRows[i]< firstCol;for (int i = 0; i < intergerMaxNum; i++){ double temp = 0.1 * i; firstCol.push_back(temp);}//string b;vector secondInterCol;// iterating through different value FILE* fp = NULL;for (int i = 0; i < intergerMaxNum; i++){ //for every file for (int j = 0; j < count; j++) { }}//Merge number of files, to a two dimension vectorvector > test2;vector B;//which is used for including the corresponding value in the test2B.push_back(0);B.push_back(1);B.push_back(2);test2.push_back(B);B.clear();B.push_back(3);B.push_back(4);B.push_back(5);test2.push_back(B);B.clear();B.push_back(6);B.push_back(7);B.push_back(8);test2.push_back(B);B.clear();for (int i = 0; i < 3; i++){ for (int j = 0; j < 3; j++) { cout << test2[i][j]<<" "; } cout << endl;}
}
转载地址:https://dequn.blog.csdn.net/article/details/109722750 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月27日 23时04分51秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
static关键字的应用
2019-04-30
关于Objecg的常见问题
2019-04-30
关于单例模式的常见问题
2019-04-30
IDEA创建直接创建spring项目失败:下载失败 ‘https://repo1.maven.org/maven2/org/springframework/spring-aop/5.2.
2019-04-30
iOS推送证书过期处理,极光推送
2019-04-30
QT数据类型转换篇
2019-04-30
QT读写文件篇
2019-04-30
QT UDP应用篇
2019-04-30
Laravel 安装笔记 Star.hou
2019-04-30
Laravel配置开发、测试、预上线、正式环境--Star.hou
2019-04-30
Laravel配置系统默认Log路径--Star.hou
2019-04-30
Laravel文件系统,自定义日志文件、管理文件--Star.hou
2019-04-30
Thinkphp3.2 修改session存储驱动
2019-04-30
Wamp PHP5.5.12安装Redis扩展--Star.Hou
2019-04-30
Spring Boot的基础知识
2019-04-30
java的多态
2019-04-30
Mysql,Oracle,Nosql非关系型数据库
2019-04-30
模拟数据库的操作
2019-04-30