I tought your issue was with the final error message not displaying...
Read your second if else again.
1 2 3
|
else if (sweaters > 3)
{ standard; cout << " Cost of a single sweater: " <<standard <<endl;
cout << " Cost of sweaters:" <<sweaters * standard << endl; }
|
If you put in, lets say, 7 or even 27, that condition will be treated because your sweaters number IS in fact > 3
If you don't want to mess with your structure too much you could add something like
1 2 3
|
else if (sweaters > 3 && sweaters < 9)
{ standard; cout << " Cost of a single sweater: " <<standard <<endl;
cout << " Cost of sweaters:" <<sweaters * standard << endl; }
|
Same issue will arise with this
1 2 3
|
else if(sweaters < 6 )
{ discount; cout << " Cost of a single sweater: " <<sale <<endl;
cout << " Cost of sweaters: " <<sweaters * discount << endl; }
|
Since its a later condition, if you put in lets say 4, it'll treat the > 3 condition, keep going down the list and then execute the < 6 condition and everything that goes along with it.
As for _getch(), it tells your program to stop until the next input. Which, if put at the very end of your program, inside the closing main() bracket, will stop your program after displaying the appropriate cout depending on the amount of sweaters before it closes automatically if you press, lets say, enter.
Good luck!