我参照了vs2014年的程序,不知道能不能解答一下,这个>>读取一个文件里面的矩阵有没有问题?结果我输出来的是不符合文本的
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int col, row;
char file[] = "C:\\Users\\Administrator\\Desktop\\Mat.txt";
ifstream infile(file);
if (infile.fail()) { cout << "读取文件失败" << endl; return 0; }
infile >> col; infile.ignore(1024, ',');
infile >> row;
cout << row <<'\t'<< col << endl;
system("pause");
return 0;
}