+ 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?
23 Réponses
+ 19
That's a problem with the code playground. You need to split multiple inputs into separate lines.
Try it in your own IDE.
+ 8
Thank you so much! I tried it in an online compiler and it worked.
+ 8
I hope the downvoter plans to explain why they downvoted the answer
+ 8
I use a while or for loop to get the input a hundred times, and then add each input to an array.
+ 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
+ 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!
+ 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.
+ 6
Um, no I don't really use stuff like that.
+ 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
+ 5
Im not into C++ sorry... Do you code other languages too? Hope somebody helps you here.
+ 5
Great! 🤗 Do you two guys use the Chat-App for Sololearn Discord?
+ 5
Ok, thanks I'll have a look at that later.
+ 5
Yeah xD
+ 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.
+ 5
Just a Rather... Do you use Discord?
+ 5
haha.. here isnt any way to write about coding stuff instead of comments, or am i wrong?
+ 5
int no=5, a [no],I;
for(i=0;i<=no;i++)
{
cout<<"enter no";
cin>>no[i];
}
+ 4
You're welcome Lincoln :)
To make drawings in web pages, you use something called a canvas element.
+ 4
No I don't use discord, I'm quite young xD
+ 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] ;
}