【发布时间】:2020-07-23 12:40:34
【问题描述】:
我写了以下代码
switch (number) {
case 1:
int accountnumber[20];
char firstname[20], lastname[20], balance[20];
cout << "please enter the account number of the user " << endl;
cin.getline(accountnumber, 20);
cout << "please enter the first name of the user " << endl;
cin.getline(firstname, 20);
cout << "please enter the last name of the user " << endl;
cin.getline(lastname, 20);
cout << "please enter the balance of the user " << endl;
cin.getline(balance, 20);
ofstream myfile(" data.txt");
myfile << accountnumber;
myfile.close();
int accountnumber1[20];
ifstrean.obj("data.txt");
obj.getline(accountnumber1, 20);
cout << "data is" << accountnumber1;
obj.close();
}
显示以下错误
no matching function for call to 'std::basic_istream<char>::getline(int[20], int) '
expected unqualified-id before'.' token
我做错了什么?
【问题讨论】:
标签: c++ file-handling