编译时没有错误......但我的输出一无所获。我知道这是一个非常愚蠢的编码尝试......我主要是在处理数字......字符串的东西让我感到困惑。
#include <iostream>
#include <string>
using namespace std;
char chr;
int main()
{
string name;
string artist;
string Taylor;
string Alan;
string general;
string box;
string seating;
cout << "Enter your name followed by the return key" << endl;
cin >> name;
cout << endl;
cout << "Enter Taylor for Taylor Swift tickets or Alan for Alan Jacskon seats, followed" << endl << "by the enter key" << endl << endl;
cout << "Enter box for box seating or general for general seating, followed by the enter key" << endl << endl;
cin >> artist;
cin >> seating;
if ( artist + seating == Taylor + general )
cout << name << ", Your ticket will cost $60" << endl;
else if ( artist + seating == Taylor + box )
cout << name << ", Your ticket will cost $100" << endl;
else if ( artist + seating == Alan + box )
cout << name << ", Your ticket will cost $75" << endl;
else if ( artist + seating == Alan + general )
cout << name << ", Your ticket will cost $50" << endl;
cin >> chr;
return 0;
}