Ready to shoot myself... Can someone help me loop this program?

asdasdad
Last edited on
1
2
3
4
5
6
7
8
9
std::cout << "Would you like to quit?" << std::endl;
int usrInput = 1; 
std::cin >> usrInput;
if (usrInput == 1) 
{ 
	double ticket = 30;
	double discount, cruisecost, min_pass, passengers, maxshipcapacity;

else (usrInput !=1)}


People generally choose to require a specific condition to quit(e.g. 'q' or 0).
You do not need a condition for the else statement unless there is another action for specific condition(s). There is no closing bracket for the if statement and no opening bracket for the else statement. For the else statement (or 'if' if you do it the conventional way) use return to quit.

As for restarting the program after they have used it, do you mean after the entire program has executed and quit?

Please do not shoot yourself. When things get ridiculously complex and confusing you can start from scratch, break the problem down into smaller components and build it up piece by piece as you gain clearer understanding.
Thanks for the quick reply.

Once they are done with their initial calculations, I'd like them to get prompted if they want to run the program again or to quit.

Am I on the right track at least? I'm very sleepy and at this point, things just aren't making sense anymore.. Also getting an error for the 'else' statement in line 21 saying the program expected an expression.

Can anyone get me on the right track :/
why remove your first post?
igoyee wrote:
asdasdad

It is hard to comment the line 21 of that.

When you have code that does a thing once, you put it inside a loop that (1) runs that code and then (2) asks the user whether to repeat.
Topic archived. No new replies allowed.