Hello, I am trying to create a little game where you start off as an employer and then you can buy better apartments and get promoted to different jobs but I don't see the problem here it doesn't compile correctly. Thanks in advance and if you have any better ways of creating the game or ideas that could essentially be in there you are more than welcome to put it down in the comments:D
#include <iostream>
usingnamespace std;
int main() {
char name;
int Jobs;
cout << "Hello! Welcome to the economical game! First write your name: ";
cin >> name;
cout << "Hi " << name << ". You will start off as a employer, choose where you wanna work." << endl;
cout << "These are your options: Ikea, Wallmart, Target, Blockbuster.(Case sensitive write the exact same) " << endl;
cin >> Jobs;
if (Jobs == 'Ikea') {
cout << "Congratiulations! You chose Ikea. Your daily pay is 100$ and your apartment bill is at 70 dollars a day." << endl;
} elseif (Jobs == 'Wallmart') {
cout << "Congratiulations! You chose Wallmart. Your daily pay is 75$ and your apartment bill is at 60 dollars a day." << endl;
} elseif (Jobs == 'Target') {
cout << "Congratiulations! You chose Target. Your daily pay is 65$ and your apartment bill is at 40 dollars a day." << endl;
} elseif (Jobs == 'Blockbuster') {
cout << "Congratiulations! You chose Blockbuster. Your daily pay is 125$ and your apartment bill is at 90 dollars a day." << endl;
}
system("PAUSE");
return 0;
}
[Compiled]
Hello! Welcome to the economic game! First write your name: Sebastian
Hi S. You will start off as an employer, choose where you wanna work.
These are your options: Ikea, Wallmart, Target, Blockbuster.(Case sensitive write the exact same)
Press any key to continue . . .
[/Compiled]
A char can only hold a single char - like 'a' You better use a string. Same for Jobs.
Sth. like:
1 2 3 4 5 6 7 8
string name;
cout << "Hello! Welcome to the economical game! First write your name: ";
cin >> name;
cout << "Hi " << name << ". You will start off as a employer, choose where you wanna work." << endl;
cout << "These are your options: Ikea, Wallmart, Target, Blockbuster.(Case sensitive write the exact same) " << endl;
string Jobs;
cin >> Jobs;
Be aware that >> will end at the first whitespace character so it might be better to use getline.
@Repeater Sorry I don't know that much about c++. I'm pretty much trying to learn it from my self that's why I have soo many questions here :D thanks for the help.