I'm just trying to learn a little programming for fun. It's not for school or anything else. I'm just bored. Anyway, having never EVER had any instruction in this stuff, I'm trying to pick it up. So, I purchased the software I needed and tried to code my first program.
My first string of code worked just fine:
#include <iostream>
int main()
{
std::cout<<"Hello World!";
return 0;
}
Now, the console wouldn't stay open, so I changed the code, after reading this page to read like this:
#include <iostream>
int main()
{
std::cout<<"Does this compiler work? If so, press any key.";
cin.get();
return 0;
}
But, I get the following errors:
Compiling...
secondprogram.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\secondprogram\secondprogram.cpp( 7) : error C2065: 'cin' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\secondprogram\secondprogram.cpp( 7) : error C2228: left of '.get' must have class/struct/union type
Error executing cl.exe.
secondprogram.obj - 2 error(s), 0 warning(s)
Since I am a total newbie, I have no idea what those errors mean or how to fix them. I even checked these message boards to find a solution and couldn't find anything (I'll blame it on operator error).
So, can you help me and tell me why it isn't working? Is it me, or are the instructions on that web page wrong? THANKS!
/me puts on flame proof suit