I want to make the program require me to enter a second number in order to plus them. But it does require me to type the second? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to make the program require me to enter a second number in order to plus them. But it does require me to type the second?

It does require me to type the first one but for the socond one it doest. it determines from its own.

9th Dec 2017, 8:26 AM
Gültekin Eroğlu
Gültekin Eroğlu - avatar
9 Answers
+ 4
The code is not an issue, what you wrote is right. The problem is what you wrote in the little input window. You should write : 5 4 As @Dextozz suggested :)
9th Dec 2017, 8:56 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 4
can you show the code please ? PS : if it does not ask you to enter the second on sololearn, it is because sololearn ask all inputs before running the program
9th Dec 2017, 8:29 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 4
Yes. that's it :/ Try entering a and b on two separate lines, it should work ! https://www.sololearn.com/discuss/659854/?ref=app
9th Dec 2017, 8:45 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
I m coding like int a; cin >> a; int b; cin >> b; and run then it only wants me to enter the int a , why not asking the same for the int b ?? is it because you re saying solo learn right ? when I use the code somewhere else it will ask ?
9th Dec 2017, 8:32 AM
Gültekin Eroğlu
Gültekin Eroğlu - avatar
+ 2
Yes it's because of SoloLearn. Just input everything at once and it will work. My guess is when you input for eg. 5 4 It stores those inputs in a list or an array and whenever it reaches a cin it takes the first not used value from that list.
9th Dec 2017, 8:46 AM
Dextozz
Dextozz - avatar
+ 1
oooh I got it thank you very much @Baptiste E. Prunir and @Dextozz
9th Dec 2017, 9:00 AM
Gültekin Eroğlu
Gültekin Eroğlu - avatar
0
you mean by two seperate lines : int a ; <<endl int b; ???? @Baptiste E. Prunir
9th Dec 2017, 8:48 AM
Gültekin Eroğlu
Gültekin Eroğlu - avatar
0
can you pls write the right codes ? I m very new at coding :)
9th Dec 2017, 8:51 AM
Gültekin Eroğlu
Gültekin Eroğlu - avatar
0
SoloLearn de bütün degerleri tek seferde alabilirsin bu sololearn in kendinden kaynaklaniyor yukaridaki arkadasin dedigi gibi. Yani: cin>> a>> b>> c; yazarak alirsin. Deger girerken de aralarinda bosluk koyman gerekir yani 3 14 289 seklinde. (a=3 , b=14, c=289)
9th Dec 2017, 10:52 AM
Mustafa K.
Mustafa K. - avatar