c++,while(getline(infile,line)) { while(getline(infile,line)) { istringstream is(line); is>>equipment[P].amount>>equipment[P].price>>equipment[P].num>>equipment[P].lyr>>equipment[P].sbmc>>equipment[P].ssbm>>equipment[P].gmsj>>equipment[P].syzk; P++;Q
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/26 22:10:04
c++,while(getline(infile,line)) { while(getline(infile,line)) { istringstream is(line); is>>equipment[P].amount>>equipment[P].price>>equipment[P].num>>equipment[P].lyr>>equipment[P].sbmc>>equipment[P].ssbm>>equipment[P].gmsj>>equipment[P].syzk; P++;Q
c++,
while(getline(infile,line))
{
while(getline(infile,line))
{
istringstream is(line);
is>>equipment[P].amount>>equipment[P].price>>
equipment[P].num>>equipment[P].lyr>>
equipment[P].sbmc>>equipment[P].ssbm>>equipment[P].gmsj>>equipment[P].syzk;
P++;
Q++;
}
}
不太懂
c++,while(getline(infile,line)) { while(getline(infile,line)) { istringstream is(line); is>>equipment[P].amount>>equipment[P].price>>equipment[P].num>>equipment[P].lyr>>equipment[P].sbmc>>equipment[P].ssbm>>equipment[P].gmsj>>equipment[P].syzk; P++;Q
就是从一个文件中读一行数据,然后吧这行数据给一个istringstream
,用istringstream 将内容中的字符串string 一个个的赋给equipment[p] 中的相应值,
然后读取下一行赋给equipment[p + 1]