日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

C++2 dimension vector

發布時間:2025/3/18 c/c++ 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C++2 dimension vector 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

// 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<string> test1; vector<string> test3; //Open File and Count the number of files for (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 vector vector<int> 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]<<endl; }//find the largesting among all numberOfRowsdouble max = *max_element(numberOfRows.begin(), numberOfRows.end()); int intergerMaxNum = (int)max;//Forming the corresponding intermediate table vector<double>firstCol; for (int i = 0; i < intergerMaxNum; i++) {double temp = 0.1 * i;firstCol.push_back(temp); } //string b; vector<string>secondInterCol; // iterating through different value FILE* fp = NULL; for (int i = 0; i < intergerMaxNum; i++) {//for every filefor (int j = 0; j < count; j++){} }//Merge number of files, to a two dimension vectorvector<vector<int> > test2; vector<int>B; //which is used for including the corresponding value in the test2 B.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; }

}

總結

以上是生活随笔為你收集整理的C++2 dimension vector的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。