0

I have a mistake in my code. C++.

Hi guys. My code is about guessing de number 67 having 6 tries, and it works but when you put a low number and then a high number, the code doesn’t count that a try. I don’t know where is the mistake. For example, if you put 50 and then 90 the program do this: you have 5tries The number you have to guess is higher. Try again: The number you have to guess is lower. Try again: you have 4tries https://code.sololearn.com/c3ZVv13I50R3/?ref=app

30th Apr 2020, 6:18 PM
Dan Delgado
Dan Delgado - avatar
4 Respuestas
+ 5
Sololearn does not have an interactive console to ask you for the input each time, you have to write all inputs before you submit and wait for output. it will work on a computer or try it on onlinegdb.
30th Apr 2020, 6:29 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
i will try on the computer thanks :)
30th Apr 2020, 11:26 PM
Dan Delgado
Dan Delgado - avatar
+ 1
i had put 5, because the first number you write counts too so it’s makes 6. I think i had fix all that you said to me and now it is look better. Thanks for helping me :)
30th Apr 2020, 11:45 PM
Dan Delgado
Dan Delgado - avatar
+ 1
I run the code and when i put the right number, the code stops, i edited that yesterday, in my computer works fine and i check here and works good. The prompt, i didn’t know about that, I thought that I have to specify everytime the prompt, but know i am going to modify my oder codes. I will try the random thing, but i don’t jnow exactly how to put it, but I’m going to research and see if i can put it and works fine. :) I really appreciate your message, I am going to try your advices in my code. It looks better the way you write it.
2nd May 2020, 1:58 AM
Dan Delgado
Dan Delgado - avatar