PDA

View Full Version : endl as in 'ell' problem



Person1357
06-06-2007, 06:23 PM
ok so i have this simple script (I'm just learning) and i keep getting this error:
C:\Documents and Settings\*******\Desktop\C++ Scripts\Exercises1.cpp `endl' undeclared (first use this function)

(Each undeclared identifier is reported only once for each function it appears in.)

C:\Documents and Settings\*******\Desktop\C++ Scripts\Exercises1.cpp `end' undeclared (first use this function)

***I'm using Dev-C++ 4.9.9.2

#include <iostream>
int main()
{
int x = 5;
int y = 7;
std::cout <<endl;
std::cout << x + y << " " << x * y;
std::cout <<end;
return 0;
}

Distort
06-06-2007, 07:28 PM
#include <iostream>
int main()
{
int x = 5;
int y = 7;
cout<<endl<<x + y << "\n" << x * y<<endl;
return 0;
}

duther
06-07-2007, 05:42 PM
ok so i have this simple script (I'm just learning) and i keep getting this error:
C:\Documents and Settings\*******\Desktop\C++ Scripts\Exercises1.cpp `endl' undeclared (first use this function)

(Each undeclared identifier is reported only once for each function it appears in.)

C:\Documents and Settings\*******\Desktop\C++ Scripts\Exercises1.cpp `end' undeclared (first use this function)

***I'm using Dev-C++ 4.9.9.2

#include <iostream>
int main()
{
int x = 5;
int y = 7;
std::cout <<endl;
std::cout << x + y << " " << x * y;
std::cout <<end;
return 0;
}

endl is into the std namespace.

Timk77
06-11-2007, 03:12 AM
#include <iostream>
using namespace std;

int main()
{
int x = 5;
int y = 7;
cout<<endl<<x + y << "\n" << x * y<<endl;
return 0;
}

Macrosoft
08-22-2007, 06:51 PM
say using namespace std;

after your includes

then take away all the std things

also, all your output things can be put in one line connected with <<

Edit: look at timk's post, its right

you might wana add system("PAUSE"); too, it pauses the script

Spky
08-22-2007, 07:15 PM
I think he may have figured it out after ~3 months.