Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions