I'm just starting to learn C++, so bear with me please. I've started with a a simple example problem copied out of a book, and I've checked and re-checked several times to make sure the code is identical. The code is:

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

I've tried to compile using Dev-C++ version 4.9.8.0, and it keeps highlighting that one section of code that is blue. I tried changing a couple simple things, but since I'm just starting to code I don't really know what I'm doing. Can someone please help me out? Thanks.

Recommended Answers

All 3 Replies

std::cout << std::endl;
Member Avatar for iamthwee

You may also need to pause the program to see the results...

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

Of course! I forgot that I had to put the 'std::' code after every, um, code thingy. I'm going to try and use 'using namespace std;' for now so I don't forget to put those individual codes everywhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.