想在txt文件中一行录入一个结构数组的数据,一项数据里面还包含了一个自己写的类的数组,在编写读入函数时出现了这个报错 [Error]no match for 'operator>>'(operand types are'std::basic_istream and 'Point[20]'
include<bits/stdc++.h>
include"SeqList.h"
include"Point.h"
using namespace std;
struct People{//人员信息
int no;//序号
bool health;//健康为1,感染为0
string name;
string address;
string time;
Point P[20];//活动地点
};
void readData(ifstream &file,People& p)
{
file>>p.no>>p.name>>p.health>>p.address>>p.P>>p.time;
}
int readPeoInfo(People peo[])
{
ifstream fileB("PeopleData.txt"),fileA("PeopleData.txt");
if (!fileB)
{
cout<<"没有找到需要读取的PeopleData.txt,请将文件放到指定位置再次运行本程序"<<endl<<"按任意键以退出";
return -1;
}
char dustBin[500];
int i,j;
for (i = 0; !fileA.eof(); i+=2)
{
fileA.getline(dustBin,100);
readData(fileA,peo[i]);
}
fileA.close();
fileB.getline(dustBin,100);
for(j=1;!fileB.eof();j+=2)
{
fileB.getline(dustBin,100);
readData(fileB,peo[j]);
}
fileA.close();
int count = i>j?i-2:j-2;
return count;
}
typedef struct People People;
int main(){
People a[50];//创建初始人群
int count = readPeoInfo(a);
for(int i=0;i<count;i++)
{
cout<<a[i].no<<" "<<a[i].name<<" "<<a[i].health<<" "<<a[i].address<<" "<<a[i].P<<" "<<a[i].time<<endl;
}
}
```,不知道该怎么办,求解答
求解答Thanks♪(・ω・)ノ