PoorLepRecon Posted February 1, 2012 Share Posted February 1, 2012 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.ItTip.It Forum Rules <------- Read them! Link to comment Share on other sites More sharing options...
Tecmaster Posted February 2, 2012 Share Posted February 2, 2012 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 else 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 Link to comment Share on other sites More sharing options...
PoorLepRecon Posted February 2, 2012 Author Share Posted February 2, 2012 Yes it did. Many thanks! I was able to finish up the program easily after that. Forum Updates & Suggestions <------ Let your voice be heard!Forum Games <------- Coolest place on Tip.ItTip.It Forum Rules <------- Read them! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now