Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

c++ homework help

Featured Replies

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.

compilererrors.png

 

 

 

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!

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. :)

Tecmaster532.png
Tecmaster532.png
lm9dzxe3.png
Owner of the Quest Point Cape

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.