SRL Archive - C/C++ Help and Tutorials

endl as in 'ell' problem


Person1357

2007-06-06 14:23:59

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

2007-06-06 15:28:04

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

duther

2007-06-07 13:42:05

From: Person1357
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

2007-06-10 23:12:13


#include <iostream>
using namespace std;

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

Macrosoft

2007-08-22 14:51:54

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

2007-08-22 15:15:46

I think he may have figured it out after ~3 months.