(while loop structure)
Write a short program that asks for your height in integer inches and then converts your height to feet and inches. Use a const symbolic constant to represent the conversion factor (Inches per ft). The only way to exit the program would be for height in inches be 999.
#include <iostream>
using namespace std;
int main(){
int heightInches =0;
const int FEET=12;
while(heightInches!=999){
cout<<"Enter your height in integer inches (999 - exit): ";
cin>>heightInches;
if(heightInches!=999){
cout << "Your Height is" << endl;
cout << heightInches / FEET << " feet" << endl;
cout << heightInches % FEET << " inch(s)" << endl<< endl;
}
}
system("pause");
return 0;
}
Comments
Leave a comment