It's a difficult question to describe but, I want the maximum amount of times my for loop to increment something to be 5 times, but I want it to continue looping the 5th iteration so it repeats letting the user know 5 is the maximum amount of times, and every time that uses chooses to iterate the loop on my switch menu it won't iterate any further than 5.
I have an idea of what the for loop should look like, but i'm lost as to how I should make the conditional while statement look that sets the boundaries.
Lol I don't mean an infinite loop, just user controlled increment and at 5 it'll just repeat what the value of 5 is each time they choose that option to increment it
I mean it's a whole chunk of code so i'll just post one of the functions that has the loop
The user is supposed to enter 1 and it will upgrade once, the first upgrade cost should be 100, if they enter 1 again it'll become engine level 2 and become 300, engine level 3 600, engine level 4, 1000, engine level 5 1500. Once it reaches engine level 5 it should stop incrementing. If they put -1, it should go back to the previous upgrade cost and engine level, the least being 0. I just don't know how to get the calculation or loop that sets that boundary right.. I'm only having trouble on my switch statement case 1 and -1.
Here's the code:
int modMenu(int choice, int carCost, int engineLevel, int upgradeCost, int quoteNumber)
{
int Total = 0;
choice = 0;
engineLevel = 0;
const int hundred = 100;
while(choice != 4)
{
cout<<"Do you want to upgrade your car?"<<endl;
cout<<"[-/+1] Downgrade / Upgrade Engine"<<endl;
cout<<"[ 2] Clear all upgrades"<<endl;
cout<<"[ 3] Reset car"<<endl;
cout<<"[ 4] Buy Car!!!"<<endl;
cout<<"What would you like to do?: ";
cin>>choice;