Debugging: Finding errors

Syntax errors are usually pointed out by the compiler when you try to run it. The message displayed can vary from one compiler to another. The best way to learn about the types of error message that can occur is to take a working program and "break it", create an error. Then run it to see what error message you get.

1
2
3
4
5
6
7
8
//Hello World
#include <iostream>
using namespace std;
int main(void) {
  cout<<"Hello World\n";
  system("pause");
  return 0;
} //main
CODE

For instance, you might leave out the line that says "using namespace std;". The picture below shows the error messages.cout unknown

Usually, you can click on the error message to highlight the error in the code.

NEXT: Errors at end of line