2. First Programs
First Error
Observe the short program below:
int main() { cout << (5+(6-4)*2)*10 }
Due to a slight, but very common
error, this program cannot be executed. The fact that programming languages
have strict rules should not surprise anyone. The error in this program is a
simple one – we have neglected to terminate the cout
statement
by a semicolon.
After correcting the error and executing the program, you should get this as the result:
STDOUT: 90
Can you find both errors in the following program?
int main() { cout 2+(7-1)*3)*4; }