Why is cout called an operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Why is cout called an operator

15th Jun 2019, 10:09 AM
Chidi Anioke
15 Answers
+ 9
std::cout is a global object, not an operator. << is an operator.
15th Jun 2019, 10:34 PM
Sonic
Sonic - avatar
+ 8
Because it concentrates on output.
27th Jun 2019, 1:31 PM
Manisha Singh
Manisha Singh - avatar
+ 5
Chidi Anioke, concentrate on how to *use* it, how to bring output to the screen. How it works internally, together with all the terminology, is something you can gradually pick up as you go.
15th Jun 2019, 12:55 PM
HonFu
HonFu - avatar
+ 4
~ swim ~ please can u explain further. Your terminologies (overloads ostream extraction operation) is not clear. I am new hear, u know Thanks a million.
15th Jun 2019, 10:54 AM
Chidi Anioke
+ 4
Woooow!! Okey, thanks.
15th Jun 2019, 11:20 AM
Chidi Anioke
+ 4
U are a good friend HonFu
15th Jun 2019, 12:59 PM
Chidi Anioke
+ 4
Thank you so much @Sonic Is there a global Class to which the global object is a part of.
15th Jun 2019, 10:38 PM
Chidi Anioke
+ 3
Chidi Anioke yes the std::cout belongs to global std::ostream class which is defined in std namespace and its declaration resides in <iostream>.
16th Jun 2019, 2:00 AM
GHOST.scared("yes");
GHOST.scared("yes"); - avatar
+ 2
Thank you GHOST.scared("yes"); Just for clarification: Std means standard, right? Please in a more generic terms can u kindly explain what you mean by 1. std::ostream class being defined in std namespace. 2. And it's declaration resides in <iostream> Thank you.
16th Jun 2019, 2:21 AM
Chidi Anioke
+ 2
Since it writes to the output stream 😉
16th Jun 2019, 11:52 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
Because its a keyword and we used to print a message on the console
16th Jun 2019, 11:50 AM
Fahad Hasan
Fahad Hasan - avatar
+ 1
Chidi Anioke Sorry friend for being late.... 1st. For std, you are definitely right it stands for standard. 2nd. For std::ostream I assume u have learned classes. std::ostream is a stand alone class which stands for output stream. It outputs stream of bytes to the console. This class is declared in <iostream> header which means that its signature, and its functions declaration lies within this iostream header. And std::cout is one of these functions, for which exertion operator has been overloaded. Remember: cout is a function and << is the operator. ostream class is defined in namespace std. Which means that its implementation is present in std namespace. Its internal mechanism like how should we for example, output int, float and other data types to terminal or console. I hope this helps u... Happy Coding
23rd Jun 2019, 5:59 AM
GHOST.scared("yes");
GHOST.scared("yes"); - avatar
+ 1
Chidi Anioke Friend i checked ur profile. I think you have jumped in to Cpp recently so i suggest you to not go into deeper concepts but spend this time in getting ur basics extremely right. Afterthen ofcourse you can crack C++ to its knees. Take your time
23rd Jun 2019, 6:13 AM
GHOST.scared("yes");
GHOST.scared("yes"); - avatar
+ 1
Cout is a term for console output
22nd Jul 2019, 6:21 PM
Henry Rice
Henry Rice - avatar
+ 1
It's not a operator. Cout means console output which you give output in c++
18th Aug 2019, 9:49 AM
🌠Ratnesh Rakesh Ranjan 🇮🇳
🌠Ratnesh Rakesh Ranjan 🇮🇳 - avatar