Convert the algorithm in pseudocode below to syntactically c

Convert the algorithm in pseudocode below to syntactically correct C++ code Calculate height Display instructions Initialize total_height to zero Get number of feet in height Add feet in height times 12 to total_height Get number of inches in height Add number of inches to total_height Display number of feet Display number of inches Display total_height End

( i don\'t understand the question, i just learned until chapter 5\" here is what I understand:

#include <iostream>

#include <cmath>

using namespace std;

int main ()

{

int total_height=0;

int feet;

int inches;

int total_feet;

cout << \"Enter your height in feet \" << endl;

cin >>feet;

total_feet = feet * 12;

cout << \"Enter your height in inches\" << endl;

cin>> inches;

total_height = total_feet + inches;

cout << \" Your height in feet is \"<< feet<< endl;

cout << \" Your height in inches is \" << inches << endl;

cout << \" Thus, your total height is \" << total_height << endl;

return 0;

}

help me

Solution

#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
//Initialize total_height to zero
int total_height=0;
int feet;
int inches;
int total_feet;

//Get number of feet in height
cout << \"Enter your height in feet \" << endl;
cin >>feet;
//Add feet in height times 12 to total_height
total_feet = feet * 12;
// Get number of inches in height
cout << \"Enter your height in inches\" << endl;
cin>> inches;
//Add number of inches to total_height
total_height = total_feet + inches;

//Display number of feet
cout << \" Your height in feet is \"<< feet<< endl;
//Display number of inches
cout << \" Your height in inches is \" << inches << endl;
//Display total_height
cout << \" Thus, your total height is \" << total_height << endl;
return 0;
}

OUTPUT:
Enter your height in feet
5
Enter your height in inches
6
Your height in feet is 5
Your height in inches is 6
Thus, your total height is 66

NOTE: Every thing is fine with the code and algorithm

Convert the algorithm in pseudocode below to syntactically correct C++ code Calculate height Display instructions Initialize total_height to zero Get number of
Convert the algorithm in pseudocode below to syntactically correct C++ code Calculate height Display instructions Initialize total_height to zero Get number of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site