>>2324
>Oh, and one other question: why should I use std::cout instead of using namespace std?
A "namespace" groups things together so that two objects sharing the same name don't conflict with eachother.
For example, if you created your own "cout", like this:
#include <iostream>
#include <fstream>
int main(void)
{
// Please don't actually name your variable "cout"
std::ofstream cout("some_file.txt");
cout << "This gets saved to a file" << std::endl;
std::cout << "This gets printed on the screen" << std::endl;
return 0;
}
This works fine, since "cout" is in a different namespace than "std::cout".
If you were to use "using namespace std" though (and removed all the "std::" parts),
then "This gets printed on the screen" would also be written to the file, since the local
"cout" overloads the global one.
Of course, for simple programs, it doesn't actually matter - the "rule" is for complex programs with lots of namespaces.
tl;dr - Be specific so that the computer and other programmers know what the hell you're trying to do