Question: Need to add comments to every line. (C++)    #include iostream using namespace std; int main() { int num1, num2; double length; double width; double area; double result; char ch; string myStr; length 4; width 8; area= length * width; num1 = 5; num2 = 7; result = static_cast(num2)/num1 cout << "7 / 5 is" << result << endl; cout <<"Enter a character: "; cin >> ch; cout << endl; cout <<"Enter the length of the rectangle: "; cin >> length; cout << endl; cout << "Enter the width of the rectangle: "; cin >>width; cout <

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 7PP
icon
Related questions
Question

 

Question: Need to add comments to every line. (C++) 

 

#include iostream

using namespace std;

int main()
{
int num1, num2;
double length;
double width;
double area;
double result;
char ch;
string myStr;

length 4;
width 8;

area= length * width;

num1 = 5;
num2 = 7;

result = static_cast<double>(num2)/num1

cout << "7 / 5 is" << result << endl;

cout <<"Enter a character: ";
cin >> ch;
cout << endl;

cout <<"Enter the length of the rectangle: ";
cin >> length;
cout << endl;

cout << "Enter the width of the rectangle: ";
cin >>width;
cout <<endl;

cin.get(ch);

cout <<"Enter a sentence: ";
getline(cin, myStr);
cout << endl;


area = length * width;
cout <<"The area of the rectangle is " << area << endl;

cout << myStr << endl;


return 0
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr