Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Where is the syntax and/or logical errors? comment that line of code out, but le

ID: 3876406 • Letter: W

Question

Where is the syntax and/or logical errors?

comment that line of code out, but leave the original code so we can see the mistake. Then, type in a correct line of code "below" the line you are correcting that fixes the error. Next, explain your correction with a correctly placed and formatted C++ comment.

find as many lines of code that you can, that have an error in them. Next, comment that line of code out, but leave the original code so we can see the mistake. Then, type in a correct line of code "below" the line you are correcting that fixes the error. Next, explain your correction with a correctly placed and formatted C++ comment.

1 // findErrors.cpp

2 / This program has several syntax and logic errors.

3

4 #include iostream

5 using namespace std

6

7 int main

8 {

9 doubl length = 0, // Length of a room in feet

10 width = 0; // Width of a room in feet

11 area == 0; // Area of the room in sq. ft.

12

13 // Get the room dimensions

14 cout << "Enter room length (in feet): "

15 cin >> length;

16

17 cin << "Enter room width (in feet): ";

18 cout >> legth;

19

20 // Compute and display the area

21 width = length + area;

22 cout << "The area of the room is " << area " square feet." << endline;

23

24

25

Explanation / Answer

// findErrors.cpp

/// This program has several syntax and logic errors.
// This program has several syntax and logic errors.

//#include iostream
#include <iostream>

//using namespace std
using namespace std;

//int main
int main()

{

//doubl length = 0, // Length of a room in feet
double length = 0, // Length of a room in feet

//width = 0; // Width of a room in feet
width = 0, // Width of a room in feet

//area == 0; // Area of the room in sq. ft.
area = 0; // Area of the room in sq. ft.

// Get the room dimensions

//cout << "Enter room length (in feet): "
cout << "Enter room length (in feet): ";

cin >> length;

//cin << "Enter room width (in feet): ";
cout << "Enter room width (in feet): ";

//cout >> legth;
cin >> length;

// Compute and display the area

width = length + area;

//cout << "The area of the room is " << area " square feet." << endline;
cout << "The area of the room is " << area << " square feet." << endl;

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote