+ 9

How do you loop cin statements?

I can't seem to make a loop that takes input from the user more than once. When I try, it just asks for input once. Does anyone know if this is possible?

17th Aug 2018, 6:14 PM
Lincoln
Lincoln - avatar
23 Antworten
+ 19
That's a problem with the code playground. You need to split multiple inputs into separate lines. Try it in your own IDE.
17th Aug 2018, 6:17 PM
Just A Rather Ridiculously Long Username
+ 8
Thank you so much! I tried it in an online compiler and it worked.
17th Aug 2018, 6:19 PM
Lincoln
Lincoln - avatar
+ 8
I hope the downvoter plans to explain why they downvoted the answer
17th Aug 2018, 6:28 PM
Just A Rather Ridiculously Long Username
+ 8
I use a while or for loop to get the input a hundred times, and then add each input to an array.
17th Aug 2018, 9:47 PM
Rowsej
Rowsej - avatar
+ 8
No it not ,if its is ,I have not see a code there that portray such ,that a problem with the code playground , a bug one I suppose will not be fixed easy because so many code there relay on it , but you can still try it in your own IDE I am show it be much better ,I hope this help
18th Aug 2018, 7:54 AM
George S Mulbah II
George S Mulbah II - avatar
+ 7
How the SoloLearn C++ playground works, it takes all the inputs all in one take. And, I found out, on iOS app, inputs can be seperated by spaces!
18th Aug 2018, 9:11 AM
Rowsej
Rowsej - avatar
+ 6
Hi, Sean, no I don't use other languages but I do know some html and css. I've actually been wondering how people make drawings in html and css if you have any idea how to.
17th Aug 2018, 6:24 PM
Lincoln
Lincoln - avatar
+ 6
Um, no I don't really use stuff like that.
17th Aug 2018, 6:25 PM
Lincoln
Lincoln - avatar
+ 6
Yeah, but when I try, it just asks me for one input. I know you can have multiple inputs with multiple lines, but that's not really what I'm looking foe
18th Aug 2018, 7:54 AM
Lincoln
Lincoln - avatar
+ 5
Im not into C++ sorry... Do you code other languages too? Hope somebody helps you here.
17th Aug 2018, 6:17 PM
Sean
Sean - avatar
+ 5
Great! 🤗 Do you two guys use the Chat-App for Sololearn Discord?
17th Aug 2018, 6:22 PM
Sean
Sean - avatar
+ 5
Ok, thanks I'll have a look at that later.
17th Aug 2018, 6:28 PM
Lincoln
Lincoln - avatar
+ 5
Yeah xD
17th Aug 2018, 6:29 PM
Lincoln
Lincoln - avatar
+ 5
Lincoln Yes you can find it here in Sololearn in the HTML5 Section too. For drawings in HTML5 you can use SVG and Canvas. You can also animate in HTML5. With SVG you can also import Vector Graphics.
17th Aug 2018, 6:36 PM
Sean
Sean - avatar
+ 5
Just a Rather... Do you use Discord?
17th Aug 2018, 6:37 PM
Sean
Sean - avatar
+ 5
haha.. here isnt any way to write about coding stuff instead of comments, or am i wrong?
17th Aug 2018, 8:51 PM
Sean
Sean - avatar
+ 5
int no=5, a [no],I; for(i=0;i<=no;i++) { cout<<"enter no"; cin>>no[i]; }
18th Aug 2018, 4:23 PM
reshma kachhadiya
reshma kachhadiya - avatar
+ 4
You're welcome Lincoln :) To make drawings in web pages, you use something called a canvas element.
17th Aug 2018, 6:26 PM
Just A Rather Ridiculously Long Username
+ 4
No I don't use discord, I'm quite young xD
17th Aug 2018, 8:16 PM
Lincoln
Lincoln - avatar
+ 4
you can achieve by using while loop with statement of - 1 i. e, while(-1){ cin>>variable name;} in the same you can use array for inserting many values at a time //for 10 times input int n=10, a[n]; for(int i=0; i < n; i++) { cin>>a[i] ; }
18th Aug 2018, 12:10 PM
Kartik Prajapati
Kartik Prajapati - avatar