Simplest question you will ever have to answer...
Hi, I'm learning C++, and I copied the code below out of a book I am learning from. It gives me the errors:
Quote:
15 C:\Dev-Cpp\Projects\FirstProject\main.cpp `cout' undeclared (first use this function)
15 C:\Dev-Cpp\Projects\FirstProject\main.cpp `endl' undeclared (first use this function)
when I try to compile it (in Dev-C++).
Here is the source code:
Code:
#include <iostream>
#include <stdlib.h>
int AddOne(int start)
{
int newnumber;
newnumber = start + 1;
return newnumber;
}
int main(int argc, char *argv[])
{
int testnumber;
int result;
testnumber = 20;
result = AddOne(testnumber);
cout << result << endl;
system("PAUSE");
return 0;
}
Can you tell me what's causing the problem? I just started learning C++ a day ago, and I haven't a clue what is wrong with this source code. Thank you soooo much!! It is probably a silly thing that I forgot to put in...