+ 3
Difference between cin and cout in cpp and how to implement it with examples.
2 Antworten
+ 5
cin is an object of the input stream and is used to take input from input streams like files, console, etc. cout is an object of the output stream that is used to show output. Basically, cin is an input statement while cout is an output statement.
They also use different operators. cin uses the insertion operator( >> ) while cout uses the extraction operator( << ).
For example, if you want to read an int value in a variable my_int(using cin) and then print it to the screen(using cout), you'd write:
#include<iostream>
int main() {
int my_int;
std::cin >> my_int;
std::cout << my_int;
return 0; }
+ 4
cin is used to take input from the user and cout to print something...plz do take c class in sololearn app .there u can find more of it...