Answer to Question #326624 in Algorithms for KeKo

Question #326624

(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.



1
Expert's answer
2022-04-10T12:36:31-0400


#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;
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS