- 1

Does this program work?

//This program will convert height in feet and inches to height in metric meters, and centimeters //This program will take feet and inches as an input //Then the program will display the feet and inches converted to metric meters as well as centimeters // Input : heightInFeet, heightInInches // Output : heightInMetricMeters, heightInCentimeters // Author : Derek, Date : September 25, 2019 // #include <iostream> using namespace std; //Constant Declaration const float METERS_PER_FOOT = 0.3048; const float METERS_PER_INCH = 0.0254; const int CM_PER_FOOT = 30; const float CM_PER_INCH = 2.54; { std cout << "What is the height in feet and inches?"; std cin >> heightInFeet heightInInches; heightInMetricMeters = (heightInFeet*METERS_PER_FOOT) + (heightInInches*METERS_PER_INCH); std:: cin>> heightInMeters; std:: cout<< "The height of the person or object in meters is"; std:: cout<< heightInMeters; std cout << "What is the height in feet and inches?"; std cin >> heightInFeet, heightInInches; heightInCentimeters = (heightInFeet*CM_PER_FOOT) + (heightInInches*CM_PER_INCH); std:: cin>> heightInCentimeters; std:: cout<< "The height of the person or object in centimeters is"; std:: cout<< heightInCentimeters; return0; }

25th Sep 2019, 11:06 PM
Derek
2 Answers
+ 2
Derek Write this code in Sololearn Playground. Then you can see. But it will not work as you didn't write int main() after declaration of constant. There Maybe some other syntax errors.
5th Nov 2019, 7:02 AM
A͢J
A͢J - avatar
+ 1
Compile it, then you will see if it works. You can use the playgound to check for sntax errors.
26th Sep 2019, 1:56 AM
Manual
Manual - avatar