컴파일 할 때 오류 없음 ...하지만 출력에 아무런 영향이 없습니다. 나는 이것이 코딩에있어서 매우 멍청한 시도라는 것을 알고있다. 나는 주로 숫자로 작업 해왔다 ... 끈 같은 종류의 것들이 나를 혼란스럽게 만든다.단순한 중첩 된 "If else"문
#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;
}
당신은 그것에 대해 자세히 설명해 줄 수 있습니까? –