在使用g ++ 4.9.2编译器的Linux环境中,在C ++代码中,我尝试了.. catch块,如下所示:
#include <vector>
int main()
{
std::vector< std::vector<double> > A, B; // The only modified line !!
int i, j;
ifstream ifp;
ifp.open("test1.in", ios::in);
cout << "Matrix A" << setw(40) << endl;
for(i=0;i<M;i++)
{
for(j=0;j<N;j++)
{
ifp >> A[i][j];
cout << setw(20) << A[i][j];
}
cout << endl;
}
ifp.close();
ifp.open("test2.in", ios::in);
cout << "Matrix B" << setw(40) << endl;
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
ifp >> B[i][j];
cout << setw(20) << B[i][j];
}
cout << endl;
}
ifp.close();
cin.get();
}
线索?