亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

 getline(inFile, p[i].name);      //未找到匹配的重載函數 頭文件什么都有,錯誤在哪啊?

 getline(inFile, p[i].name);      //未找到匹配的重載函數 頭文件什么都有,錯誤在哪啊?

C++
xungeer29 2017-10-10 13:26:23
#include<iostream>#include<fstream>#include<cstdlib>#include<string>using namespace std;struct Patron{?char name[20];?double money;};int main(){?cout << "請輸入捐獻者數目";?ifstream inFile;?inFile.open("homework6_9.txt");?if (!inFile.is_open())?{??cout << "Could not open the file." << endl;??exit(EXIT_FAILURE);?}??int num;?inFile >> num;?inFile. get();?char ch;?inFile >> ch;?Patron *p = new Patron[num];??for (int i = 0; i < num; i++)??{???inFile.get();???getline(inFile, p[i].name); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //未找到匹配的重載函數???inFile >> p[i].money;??}??cout << "Geand Patrons" << endl;??int count1 = 0;??int count2 = 0;??for (int i = 0; i < num; i++)??{???if (p[i].money > 10000)???{????cout << p[i].name <<" , "<<p[i].money<< endl;????count1++;???}???if (count1 == 0)????cout << "none" << endl;??}??cout << "Other Patrons";??for (int i = 0; i < num; i++)??{???if (p[i].money <= 10000)???{????cout << p[i].name << " , "<<p[i].money<<endl;????count2++;???}???if (count2 == 0)????cout << "none" << endl;??}?inFile.close();?return 0;}
查看完整描述

1 回答

?
xungeer29

TA貢獻46條經驗 獲得超20個贊

解決了,問題好多,感覺自己好蠢。。。。。。。。。。。


查看完整回答
反對 回復 2017-10-10
  • 1 回答
  • 0 關注
  • 2215 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號