+ 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
3 Respostas
+ 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.
+ 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
+ 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