C++ cin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C++ cin

What do you do when you want to find input for more than one integer at once?

8th May 2019, 1:59 AM
Pikachu
Pikachu - avatar
4 Answers
+ 3
The >> operator can be cascaded to read data into multiple variables. Eg: int a, b; cin>>a>>b; Alternatively, one can also use multiple cin statements to get the same result. Also, on Code Playground, even for multiple cin statements present in a code fragment, only a single input dialog is displayed before the program's execution. This is because the execution does not take place on your device but rather on their server and so they require all input that will be required by the program. Thus, to input data in more than one cin statement, separate the data inside the dialog with newlines. This will redirect the input to respective cin statements. This limitation exists for all other languages in Code Playground except Web and PHP. Also, similar queries have been posted before in the Q/A section. Kindly use the search bar next time. https://www.sololearn.com/discuss/1544816/?ref=app https://www.sololearn.com/Discuss/1740941/?ref=app https://www.sololearn.com/Discuss/1741084/?ref=app
8th May 2019, 2:33 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
chain extraction operators to input into several variables in one cin.
8th May 2019, 2:31 AM
Choe
Choe - avatar
0
🧐
8th May 2019, 8:31 AM
esQmo_
esQmo_ - avatar
0
You can input as many times as you want just make sure to input everything you want under each other
14th Aug 2019, 7:33 PM
The unknown 321
The unknown 321 - avatar