#include <iostream>
#include <fstream>
using namespace std;
const int ROW = 27;
const int VOL = 30;
int main(){
double d[ROW][VOL];
ifstream in("D:\\data.txt");//打開文件
//讀數據。。
for(int i = 0; i < ROW; ++i){
for(int j = 0; j < VOL; ++j){
in >> d[i][j];
}
}
in.close();//關閉文件
//輸出結果
for(int i = 0; i < ROW; ++i){
for(int j = 0; j < VOL; ++j){
cout<<d[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
讀取txt文件,存入數組
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.