C++2 dimension vector
发布日期:2021-06-29 21:14:30
浏览次数:3
分类:技术文章
本文共 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月17日 02时49分54秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
MVC是什么
2019-04-30
使用C#创建Windows服务
2019-04-30
Visual Studio 命令行wsdl生成C#操作类
2019-04-30
easyui-dialog
2019-04-30
jquery.显示隐藏切换
2021-07-03
C# Dictionary 是否包含key
2021-07-03
C#计算两个时间年份月份差&计算两个日期的时间间隔
2021-07-03
BI与ETL
2021-07-03
超级实用但很少人知道的 VS 技巧[更新]
2021-07-03
C# 矩阵取值
2021-07-03
台积电/联发科/富士康/高通/三星/中芯国际/ASML/华为、光刻机、芯片/
2021-07-03
C# Activator.CreateInstance
2021-07-03
DMZ
2021-07-03
c# EPPlus.dll
2021-07-03
sqlserver格式化-年月日
2021-07-03
C# WebApi 跨域
2021-07-03
sqlserver dateadd&datediff
2021-07-03
sqlserver 制表符、换行符、回车符
2021-07-03
C#继承类与父类序列化测试
2021-07-03
企业的核心高管团队:CEO、COO、CSO、CTO、CFO、CHO
2021-07-03