ifstream inFile;
inFile.open("Matrix\\Matrix3(1).txt"); //打开文件
if (!inFile.is_open())
{
cout << "Failure" << endl;
}
while (!inFile.eof())
{
for (a = 0; a < 3; a++)
{
for (b = 0; b < 3; b++)
{
inFile >> Matrix1[a][b]; //将矩阵存入数组
}
}
}
inFile.close();
inFile.open("Matrix\\Matrix3(2).txt"); //打开文件
if (!inFile.is_open())
{
cout << "Failure" << endl;
}
while (!inFile.eof())
{
for (a = 0; a < 3; a++)
{
for (b = 0; b < 3; b++)
{
inFile >> Matrix2[a][b]; //将矩阵存入数组
}
}
}
inFile.close();