#Need help understanding question

30 messages · Page 1 of 1 (latest)

wintry isle
#

Hi, I'm not very good at english and I need help understanding c in this question. I understand the other two fine and I've already done the first one (which was to correct the formatting) and a little bit of the second one but I just wanted to understand the third one too thanks

I have provided pictures of my code so far so you know what is going on

boreal impBOT
#

This post has been reserved for your question.

Hey @wintry isle! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

gleaming peak
#

Validate all the user inputs

#

That's creating probably a check for each user input

wintry isle
#

hmm

#

is that not in the code already

wintry isle
#

i think i figured it out, would it be adding an if/else statement before the guessing if/else-if statements indicating on whether its an integer or not

#

@gleaming peak

dusk merlin
#

input validation means you need to check whether the inputs are correct

#

i.e. your program shouldn't allow invalid inputs

wintry isle
#

like i need to make sure its an int

#

the input

gleaming peak
#

👍

dusk merlin
#

for example

wintry isle
#

hold on can i send my code i just need some advice

#

here is what i added, and here is the error message i get when i input a non integer but i want it to not consider the program to be finished yet so that it prints an error message and goes back to asking for an integer

#

could you let me know what i did wrong

dusk merlin
#

well you are calling nextInt before hasNextInt

#

the nextInt can fail already

wintry isle
#

I was thinking that

#

it calls nextint but if nextint is not an int it would fail

dusk merlin
wintry isle
#

yeah

#

uh

#

damn sorry im confused

wintry isle
#

got it nevermind

boreal impBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.