1、输入
double foundation1[3][3];
std::ifstream file("../fundament.txt");
while (file)
{
file >> foundation1[0][0]; file >> foundation1[0][1]; file >> foundation1[0][2];
file >> foundation1[1][0]; file >> foundation1[1][1]; file >> foundation1[1][2];
file >> foundation1[2][0]; file >> foundation1[2][1]; file >> foundation1[2][2];
}
2、输出
char filePath[128];
sprintf(filePath, "../fundament.txt");
fstream f;
f.open(filePath, ios::out);
for (int i1 = 0; i1 < 3; i1++)
{
for (int j1 =0;j1<3;j1++)
{
f << foundation[i1][j1] <<" " ;
}
f << endl;
}
f.close();