My computer science professor wants us to find the declaration of cout
. I've compiled a simple Hello world program using g++ and the -E parameter. Here's what my hello.cpp looks like:
#include <iostream>
using namespace std;
int main(){
string name="";
cout << "Good morning! What's your name?";
cin >> name;
cout << "Hello " << name << ".\n";
return 0;
}
My compile command:
g++ -E hello.cpp > hello.p
In hello.p, I ran a search in VIM, like so:
:/cout
I see the following line:
extern ostream cout;
Is that the declaration of cout
, and is cout
an instance of the ostream
class?
Edit:
What's the wcout
declaration there for? If I recall correctly the letter "w" stands for "wide", but I don't know what implication that has. What is a wcout
and a wostream
?
cout
into the search box. – Antiphonal