// 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;
}