main() {
bool choice1 = 0;
int morale1;
int morale = 50;
if (morale = 0){
std::cout << " Your clients are upset and regret hiring you, your fired! \n";
}
/////// Hunting Guides Decisions
std::cout << " Morale: You start with 50 morale, your decisions will increase or decrease morale. If you kill a moose you will win the adventure. If you reach 0 Morale you will fail the adventure and get fired.\n\n";
std::cout << " Its 4:30, your just waking up on the first day of a 5 day moose hunt. You begin preparing breakfast when you realise you only have enough cooking oil for 3 days. \n";
std::cout << " You are faced with 2 decisions, Use some oil today for breakfast, or save the oil and possibly burn your food for the clients. \n";
std::cout << " 1: Use oil \n 2: Dont use oil \n" ;
std::cin >> choice1;
if (choice1 == 1, morale + 20){
std::cout << " You use the oil and the breakfast is delicious +20 Morale \n";
}
else if (choice1 == 2, morale -10){
std::cout << " You didnt use the oil and the breakfast was sub-par -10 Morale \n";
}
No matter if I input 1 or 2 i get the answer 1, very confused any help would be appreciated i know its a pea brain issue but figured here is the place for pea brain questions.
if (choice1 == 1, morale + 20)
Everything to the left of the comma operator has no effect. Yor condition becomes moral+20 if moral is any value besides -20 the result will be a value other than 0. Values other than 0 are true.
you mean to do if(choice1==1){morale+=20; std::cout << "blah blah blah";}