Tag Archives: C++

How Many Syntax Errors Can You Find?


In an introductory (undergraduate or “advanced” high school) programming course, students will find their first set of difficulties in two main areas:

  • Syntax errors
  • Spelling errors

While we can classify spelling errors to be a type of syntax error, I like to differentiate the two of them to students so that they can start to understand how much of the language they are not understanding and how much is just carelessness.

Here is C++ code riddled with syntax errors and spelling errors.
How many can you find?

#include <iostream>
using namespace std;
int mymax(int a, int b)
int(main){

cout >> mymax(3,7) >> endl;
cout << myMax(12,8) << endl; return 0;

}
int mymax(int a, int b);{

int maximum = a;
if(maximun < b)

return b

else

return a;

}