I have this book programming for dummies and they gave a code I want to make sure the code is good and how do I see it on screen here is the code:
int main ()
cout << "It works!\n";
cout << "\nPress ENTER to contiune..." << endl;
Am I writing it right and what button do I push to see it and and is the code right??? I have no idea how to see what I wrote what do I press so new to this and I am scared.
I hit it and it is not letting me, they are saying line number 5
5 C:\Users\\Desktop\Seeifworks.cpp `cout' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
6 C:\Users\\Desktop\Seeifworks.cpp `endl' undeclared (first use this function)
I have no idea what this means and do I need a new complier?
hmm. it really should work if all the include and header files are in the right place.. could ya post the code with "using namespace std;" included and exactly what the errors are when you try to compile. Here's what i'd try.
using namespace std;
cout << "It works!\n\nPress ENTER to continue\n";
if it won't compile that code exactly then yeah you've got a problem with something else
my understanding is it tells the compiler to reference elements from the c++ std library.. Some people don't use it, instead prefixing certain statements with std:: (e.g: "std::cout << string;" instead of "using namespace std; cout << string;")
however, if you use cin, cout, and other std library entities more than once or twice in your program, it makes the code look kinda bleh to me, so just use:
"using namespace std;" and you won't have to worry about saying "std::" before everything
hope that made sense lol I don't know that much about it