#include #include #include #include #include #include using namespace std; int main(int argc, char** argv) { vector > matrix; //入力用配列 string line; ifstream fin; fin.open(argv[1]); //読み込みファイル if (!fin){ cout << "error : file not found" << endl; return -1; } // if fin==0 file not exist //読み込み開始 while (getline(fin, line)){ vector tmp_row; stringstream buf(line); while(!buf.eof()){ double tmp_d = 0; buf >> tmp_d; tmp_row.push_back(tmp_d); } matrix.push_back(tmp_row); } //読み込みデータ表示 for(int i = 0; i < (int)matrix.size(); i++) { cout << matrix[i][0]; for(int j = 1; j < (int)matrix[i].size(); j++) { cout << " " << matrix[i][j]; } cout << endl; } }