由于某些原因,string cin.getline (temp.Autor, 20)
它被忽略了。请看一下输出
你能帮我理解为什么吗?
struct BOOK {
char Autor[20];
char Title[50];
short Year;
int PageCount;
double Cost;
};
void new_book()
{
BOOK temp;
system("cls");
cout <<"ENTERING NEW BOOK: " << endl <<endl;
cout <<"Input the author: ";
cin.getline (temp.Autor, 20);
cout <<"Input the title: ";
cin.getline (temp.Title, 50);
cout <<"Input the year of publishing: ";
cin >> temp.Year;
cout <<"Input the number of pages: ";
cin >> temp.PageCount;
cout <<"Input the cost: ";
cin >> temp.Cost;
cout << endl;
print_book(temp);
system("pause");
}