Jump to content
  • Advertisement
Sign in to follow this  
Slimeball

Error

This topic is 4903 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know this is dumb but i cant figure out whats wrong. I type this into VC++ 6 and get the error : error C2065: 'endl' : undeclared identifier. #include <iostream> int main() { int x = 5; int y = 7; std::cout << endl; std::cout << x + y << " " << x * y; std::cout << endl; return 0; } Any help for a noob C++ programer.

Share this post


Link to post
Share on other sites
Advertisement
Still not working typed
#include <iostream>

using namspace std;

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

Share this post


Link to post
Share on other sites
Actually, I meant

#include <iostream>

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

Share this post


Link to post
Share on other sites
I would also like to point out that if you use KrazeIke's post, it will work as is without the namespace I mentioned after him.

This works fine for me in VS6 -

#include <iostream>

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





#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
int x = 5;
int y = 7;
cout << endl << x + y << " " << x * y << endl;
return 0;
}


That is an alternative though.

- Drew

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!