what is cin>> nd cout<<.whats the purpose of these in c++ or programming???

Recommended Answers

All 3 Replies

They are for getting input and pushing out output. cin is a input stream object and if you use cin >> someVariable you can think of it as from cin put value into someVariable. cout is a output stream and when you write cout << someVariable you can think of that as put someVariable into the output stream.

Note that cin and cout are objects with a number of input and output methods on varying types. << and >> are overloaded operators for those objects that "simplify" the calling of I/O methods.

See also Nathan's reply, as it's a less pedantic and more practical answer. ;)

in simple language.

cout = is used for the output of data from the computer.
for example:-

 cout<<"Hello World";

this code will output Hello World on your screen

and cin is used to take input from the user,

like
cout<<" What comes after a? ";
cin>> abc;

cin will store what ever you type.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.