这是我的代码:
#include <iostream>
using namespace std;
const int SENIOR_PRICE = 9;
const int ADULT_PRICE = 12;
const float CHILD_PRICE = 6.95;
const float TAX_RATE = .06;
int main()
{
string name;
string address;
int numSeniorTickets;
int numAdultTickets;
int numChildTickets;
cout << "Enter customer name:" << endl;
cin >> name;
cout << "Enter customer address:" << endl;
cin >> address;
cout << "How many senior season tickets?" << endl;
cin >> numSeniorTickets;
cout << "How many adult tickets?" << endl;
cin >> numAdultTickets;
cout << "How many child tickets?" << endl;
cin >> numChildTickets;
return 0;
}
用户输入姓名后,系统会提示他们输入地址。但在他们输入地址之前,它还会提示输入高级季票的数量。为什么它会跳过一行输入?这是发生的事情:
Enter customer name:
Daniel Benson
Enter customer address:
How many senior season tickets?
5
How many adult tickets?
5
How many child tickets?
5