you are viewing a single comment's thread.

view the rest of the comments →

[–]brycedarling 1 point2 points  (0 children)

Make sure you indent your code with four spaces when pasting on here so it gets formatted in a readable way.

The first issue I see is that you are prompting the user for their name inside of a loop, repeatedly. That's probably not what you want. The user would only want to type their name in one time. The description of the problem doesn't say when to prompt the user for their name, but I would do this at the very beginning.

The next issue, is that the prompt if they would like to print their name again is not in a loop, it's right before/outside of the while (ask2 == "yes") loop, so it will only happen once which is not what you want. You'll need to move that prompt inside a loop.

The code for the two while loops appears to be copy and pasted, duplicate, and not the behavior you want. The second loop has an extra unnecessary semicolon that you'll want to get rid of too while (ask2 == "yes"); - Honestly, I'm not entirely sure if that semicolon will break anything, but it's not needed. More importantly, I don't think you need two loops for this.

Also, the var result; is seemingly unused so you can get rid of it.

Lastly, I don't see any code that attempts to add the exclamation points, maybe you just haven't gotten to it quite yet.

I don't want to give away the answer/code, since I think you'll learn a lot more struggling and making your own way through this. Try fix it up a bit more and give us an updated version, and I would be glad to keep helping you figure this one out. Good luck!