Need help understanding question
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
15 Replies
⌛
This post has been reserved for your question.
Hey @B3251! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
Validate all the user inputs
That's creating probably a check for each user input
hmm
is that not in the code already
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
@Larry_springboot
input validation means you need to check whether the inputs are correct
i.e. your program shouldn't allow invalid inputs
i think i got it
like i need to make sure its an int
the input
👍
for example
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
well you are calling
nextInt
before hasNextInt
the nextInt
can fail alreadywait is that not what i do?
I was thinking that
it calls nextint but if nextint is not an int it would fail
hasNextInt
checks the next inputyeah
uh
damn sorry im confused
got it nevermind
💤
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.
💤
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.