第1个回答 2019-04-30
1)从文件读取一行:
ifstream
infile;
infile.open("文件名.txt");
if
(!infile)
{
cerr
<<
"error:
unable
to
open
input
file
!!!"
<<
endl;
system("pause");
}
string
str;
while
(getline(infile,
str))
{
//
一行一行读
....
}
2)将每个字符串按逗号分离存在一个字符串数组中
设临时变量,遍历一遍,遇逗号进行处理
PS:
刚开始弄,可能会遇到各种问题,但坚持一下迟早会解决的。。。一起加油。。。(同为菜鸟)