【发布时间】:2020-01-06 16:36:07
【问题描述】:
#include<iostream>
#include<cstring>
#include<fstream>
using namespace std;
ofstream fileData;
ifstream writeData;
void newAccount();
int main()
{
string data[10][3];
int choice=0,i,j;
fileData.open("D:\\Desktop\\input.txt");
for(i=1; i<10&&(!fileData.eof());i++)
{
for(j=0; i<3;j++)
getline(fileData,data[i][j]);
}
fileData.close();
for(i=0; i<10;i++)
{
for(j=0; i<3;j++)
cout<<data[i][j];
cout<<endl;
}
while(choice!=8)
{
cout<<" Hi, Welcome to the Bank"
<<"\n\n1.New Account.\n2.Deposit Money\n3.Withdraw Money\n4.Balance Enquiry"
<<"\n5.Account Holder List\n6.Close An Account\n7.Modify An Account\n8.Exit\n\n";
cin>>choice;
if(choice==1)
{
newAccount();
}
}
它的说法
main.cpp: In function ‘int main()’:
main.cpp:38:40: error: no matching function for call to ‘getline(std::ofstream&, std::string&)’
getline(fileData,data[i][j]);
【问题讨论】:
-
我喜欢你在最后添加的乱码,这样你就可以避免“看起来你的帖子主要是代码”
标签: c++ file-handling