0

The first part of the assignment works okay; and I think I understand the 2nd part, but I get an error message that I don't understand:enter image description here

Here is the code around it:enter image description here

(I'm trying to use a while loop to do the coin calculation... Thanks in advance. R

4
  • You probably have some issues with some parens or brackets somewhere else in your code. Make sure all your brackets match. What is there above line 20?
    – Irene
    Commented Nov 20, 2015 at 21:48
  • Above line 20 is another do while loop for the user's input and then rounding and multiplying by 100. But when I run this code above on its own there aren't any errors?? Commented Nov 21, 2015 at 2:25
  • Figured it out. I added: return 0 after the while condition. I'm not what this does? I just looked at other examples and saw it there. Commented Nov 21, 2015 at 2:30
  • returning 0 after the while condition will only make your program exit right there, so it won't work. (it will compile, but your program will do nothing after that line. Please, post the rest of your code (the first part)
    – Irene
    Commented Nov 21, 2015 at 3:20

1 Answer 1

1

The error shown is almost always caused by a problem with the previous line - a syntax error where the compiler is expecting another parameter in a function call, a semicolon is missing, a problem with parentheses or curly braces, or some other formatting/syntax error.

The problem isn't in the while loop that is shown, it's in the code immediately before it.

If this answers your question, please click on the check mark to accept the answer. Let's keep up on forum housekeeping. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .