What us get() and put() functions ? What is Stream? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What us get() and put() functions ? What is Stream?

I have written a code using get() function but I didn't understand it's working and it's use. I have inserted the code please check it and tell me where am I doing wrong. Thank you. Please reply. Give me a brief description of Stream. This is reference to code please check it 👇👇👇 https://code.sololearn.com/cQ9Y011p6B3P/?ref=app

24th Nov 2017, 8:58 AM
Rushikesh Deshmukh
Rushikesh Deshmukh - avatar
3 Answers
+ 7
For your information, that code will not run well in Code Playground, the while loop you used is incompatible with the way Code Playground works, Code Playground only accepts input once, before the code and all the inputs are sent to the server to be processed, the inputs will then be fed into your code as necessary, and when input is required, e.g. when cin >> something is processed. Your while loop does its work by repetitively trying to get user input, while there was none provided, the code will get a timeout message for doing that. I just wanted to make a note for you, in case you didn't know about it, you'll have to use local compiler to run the code.
24th Nov 2017, 12:25 PM
Ipang
+ 5
I found a tiny pdf file that explains stream object in C++, hope this helps with the question, as I can't explain it any better in any way: https://courses.cs.vt.edu/cs1044/Notes/C04.IO.pdf
25th Nov 2017, 4:41 AM
Ipang
+ 1
get() takes input from user and assign to a variable put() prints the variable to which input is assigned stream is flow of process like iostream is flow of input and output
24th Nov 2017, 11:00 AM
#RahulVerma
#RahulVerma - avatar