#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream& openFile(ifstream& in, const string& fileName)
{
in.open(fileName.c_str());
return in;
}
int main()
{
string fileName;
double v[3][3];
ifstream fread;
if (openFile(fread, "m.txt"))
{
for(int i=0;i<3;i++)
fread>>v[i][0]>>v[i][1]>>v[i][2];
}
cout<<v[1][1]<<endl;
}
其中
m.txt={
1 2 3
4 3 9
7 5 8}