Hi, I am in my first Computer Science class in college, and we are doing an exercise that asks to create syntax errors, logic errors, and runtime errors, and document what appears when we get each kind of error. I have already done everything I need for the logic and runtime errors, but my problem occurs when I create syntax errors. If I'm correct, a syntax error means that there is an error in the coding language. For example, if I remove a semicolon from the code, and attempt to run the program, the words "syntax error etc etc etc" should appear right? Well all that is appearing is the typical "error" message showing what is wrong and what line it is within. I believe I need for the actual words "Syntax error" to appear. Any ideas? Thanks.
Which compiler/environment are you programming in?
Edit: Actually, you can get a whole array of errors from missing out syntax...
Just from missing out a bracket:
C:\Users\Owner\Documents\cpp programs\tempforumhelp.cpp:5: error: expected primary-expression before 'int'
C:\Users\Owner\Documents\cpp programs\tempforumhelp.cpp:5: error: expected '}' before 'int'
C:\Users\Owner\Documents\cpp programs\tempforumhelp.cpp:5: error: expected ')' before 'int'
C:\Users\Owner\Documents\cpp programs\tempforumhelp.cpp:6: error: expected unqualified-id before 'return'
C:\Users\Owner\Documents\cpp programs\tempforumhelp.cpp:7: error: expected declaration before '}' token
All syntax errors. Hard as I try, nothing on Code::Blocks is saying 'syntax error' though (I assume because it's impossible).
If the compiler simply siad "syntax error", that wouldn't be very helpful. Compilers detect hundreds of different syntax errors and try to give you as explicit message as they can as to what it thinks the error is or at least what it was expecting.