31.5k views
1 vote
Each of the following programs has errors. Find as many as you can. 65. // Find the error in this program. #include using namespace std; int main() { int num1 = 0, num2 = 10, result; num1++; result = ++(num1 + num2); cout << num1 << " " << num2 << " " << result; return 0; }

User Behnam
by
7.1k points

1 Answer

4 votes

Answer:

There are two error in this program--

  1. In header file inclusion, file is not defined.
  2. In the statement "result = ++(num1 + num2);" , bracket is fixed after the increment operator.

Step-by-step explanation:

  • For the first error, the user needs to add the file because "#include" is used to add the library for the program which states about the function and symbols used in the program.
  • The second error is because there must be a variable with the increment operator ( increment operator is being used to increase the value of a variable by 1), but there is a small brace fix in between the operator and operands.
User Albertina
by
7.2k points