C++ 怎样从TXT文件中读取数据存到结构体数组中

日期:2016-08-29 08:41:20 人气:1

C++ 怎样从TXT文件中读取数据存到结构体数组中

直接给你个参考:(你的文件必须在当前的目录下,名为test.txt)#include<iostream>#include<fstream>usingnamespacestd;structTEST{charname[10];intscore[3];}test[10];intmain(){ifstreamin("test.txt");intn=0;while(!in.eof()){in>>test[n].name;in>>test[n].sc
    A+
热门评论