Hmm... how to describe how namespaces work
That's not important right now (and an odd concept before learning classes,) you can use cout simply and add a using namespace std at the top of the program.
Basically, there are multiple couts and the compiler has to know which one to use. std:: tells it to use the std one, you did that in your program by defining that the entire program uses std. Here's a little demonstration of namespaces.
Code:
#include <iostream>
using namespace std;
namespace Integer{
int var = 5;
}
namespace Decimal{
double var = 3.1416;
}
int main () {
cout << Integer::var << endl;
cout << Decimal::var << endl;
return 0;
}
Weird, I know, but very useful for more advanced programming, for now you can forget what I just said
Bookmarks