C++第二章PPT.ppt

C第二章PPT

//ch2-10.cpp #includeiostream #includeiomanip #includefstream void main(){ std::ifstream infile(c:\\student.dat); char name[8],id[8]; int math,eng,computer,sum; std::coutstd::setw(10)姓名 std::setw(10)身份证号 std::setw(10)数学成绩std::setw(10)英语成绩 std::setw(12)计算机成绩std::setw(10)总分 std::endlstd::endl; 定义文件变量,对intfile的操作实际是对C盘根目录中的student.dat磁盘文件的操作 infilename; while (!infile.eof()){ infileidmathengcomputer; sum=math + eng + computer; std::coutstd::setw(10)namestd::setw(10) idstd::setw(10)math std::setw(10)eng std::setw(1

文档评论(0)

1亿VIP精品文档

相关文档