Jump to content
Sign in to follow this  

c++ homework help

Recommended Posts

I have a program assigned for my C++ class that I'm having some trouble with. I have a few syntax errors that are eluding me and I was wondering if someone might take a look and see if they can identify what the problem is. I believe part of my problem is the brackets around the else statements at lines 34, 43, 49.


-removed, thanks for help




The compiler errors I get currently are these.





My whole problem might just be I'm not doing my nested if/else statements syntactically correct, so if that's the case it should be easy for me to fix once I know how to correctly do it.

Forum Updates & Suggestions <------ Let your voice be heard!
Forum Games <------- Coolest place on Tip.It
Tip.It Forum Rules <------- Read them!

Share this post

Link to post
Share on other sites

You don't need to put a condition for else statements in C++, the else will be triggered automatically if the condition in the initial if statement or any else if statements following it is not met.


For example line 34 should read


instead of

else (cash>=129.95)


The error on 49 is being caused because you have curly braces in the else condition, but not in the initial if statement. If you're going to use any curly braces in a conditional block (if, else if, else) you need to use them in all of the statements before the one you want to use it in as well.


Also don't forget to CIN the amount of money the person has, right now you're not actually asking the user for that data. ;)


Hopefully that should clean up those compiler errors for you. :)

Owner of the Quest Point Cape

Share this post

Link to post
Share on other sites

A learner is well acquainted with topics with repetition. So, it is necessary to repeat them. With the simulation services, the creators can redo the content that will not make them bored.  The best software and widget simulation technology providers will engage and make the learners understand by repeating the content.


software simulation solutions

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.