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;vector
test1;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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:SWIFT入门 Dictionary
下一篇:说说内存分析工具 MAT 的基本用法

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月27日 23时04分51秒