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 <
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
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images