### Need to set a max value on an integer

So right now at the moment im working on a project for class, we are assigned to make a game of our choice and i took this as an opportunity to really get creative and im having trouble finding out how to set a max value for one of my integers.

Heres what i've done so far ( About 2 days)

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217`` ``````#include #include #include #include using namespace std; string name; string friend1; int choice; float money = 100; int energy = 20; int workexp = 0; float wage = 8.25; int expreq = 50; int health = 100; int day = 1; // Everything is somewhat out of order, move everything around later... int main () { cout <<" Before we begin Life please start by filling out your Character's qualities"<> name; cin.ignore(); cout <<"\n This is Alpha version 0.0.1 \n\n\n"; cout <<" From here on out you decide "<>choice; if (choice == 1) { cout <<"You take a shower and recover 10 hp \n\n"; cin.ignore(); health = health + 10; cout <<" What now? \n"; goto homeloop; } else if (choice == 2) { cout <<" You sleep and regain your energy \n\n"; energy = energy + 20; day = day + 1; goto homeloop; } else if (choice == 3) { cout <<" 1) Job \n"; cout <<" 2) Mall \n"; cout <<" 3) School \n"; cout <<" 4) Food District \n"; cout <<" 5) Store \n"; cout <<" 6) Apartments \n\n"; cout <<" Where would you like to go? \n"; cin >> choice; if (choice == 1) { workloop: cout<< " What would you like to do? \n"; cout<< "1) Work (-2 Energy)\n"; cout<< "2) Ask for promotion \n"; cout<< "3) Leave \n"; cin>> choice; if (choice == 1) { if (energy >= 2) { cout<<" You Stock shelves \n"; cout<<"+ \$"<< wage<= expreq) { cout<< " You are successful! \n\n"; expreq = expreq + 75; cout<< " Pay + \$2 \n"; wage = wage + 2; cout<<" New salary = "<>choice; if (choice ==1) { goto homeloop; } } } } if (choice == 4) { cout <<"You put together a simple breakfast \n"; cout <<" + 1 hunger"<>friend1; cout << "You greet "<>choice; if (choice == 1) { cout<<"You: Hey, whats up?\n"; cout <>choice; { if (choice == 1) { cout<<"You: Yeah, I'll make sure to do that \n"; cout<

I want to set a max value of 20 for my energy int that way you cant just 'sleep' a couple times and have enough energy to go through the game without having to return home to sleep, I was also thinking of implementing a way of increasing your max energy that way you can start the day out with more energy, for example maybe you could work out for -5 energy and you max energy would go up 1.

*I know using if and else if statements gets really messy but im limited to only using them since thats what we've just gone over, i plan on possibly switching it to case statements after i've turned in the assignment, I will most likely continue on with this game just for fun.