Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use 2 slashes // when commenting your code. Each line of code should have long comments above the section or a short comment inline (on

Use 2 slashes // when commenting your code. Each line of code should have long comments above the section or a short comment inline (on the same line to the right of the line of code). I expect all code that is added/corrected to be commented and explained. Look up information in the textbook or online about how simple logic and syntax errors. There are 15 errors in the C++ program below. Some are logic and some are syntax errors. To complete this assignment, do the following: First, create a Visual C++ project to use for this assignment. Next, copy and paste the entire program into the .cpp file of your Visual C++ project. Then, find as many lines of code that 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.

Example:

// include // Missing # to begin the directive #include Lastly, copy and paste your entire .cpp file contents from Visual C++ into the answer box for this assignment.

--------OOP Lesson 0 Assignment Code-------------

// Remember to use "Courier New" for the font in all coding // submissionsso that spacing is maintained correctly

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

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

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

What are some of the reasons for poor decisions?

Answered: 1 week ago

Question

Does it use a maximum of two typefaces or fonts?

Answered: 1 week ago