Question: 1. a) Find at least three logic errors in the following program. #include using namespace std; int main() { int total; int x1; cout <

1.

a) Find at least three logic errors in the following program.

#include

using namespace std;

int main()

{

 int total; int x1; cout << "Please enter a number:"; cin >> x1; total = total + x1; cout << "Please enter another number:"; int x2; cin >> x2; total = total + x1; float average = total / 2; cout << "The average of the two numbers is " 
 << average << " "; return 0; 

}

b) Find at least five syntax errors in the following program.

 #include iostream 

int main();

{

 cout << "Please enter two numbers:" cin << x, y; cout << "The sum of << x << "and" << y 
 << "is: " x + y << " "; return; 

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!