Questions:
Write a short program that asks for your height in integer inches and then converts your height to feet and inches. Have the program use the underscore character to indicate where to type the response. Also use a const symbolic constant to represent the conversion
factor.
Explanation:
Below mention code is compiled in Visual Studio 2015 and Code Blocks 13.12,output snap is attached.. If any problem you feel and you want some explanation feel free to contact us.
Code:
Output:
Related Articles:
Write a short program that asks for your height in integer inches and then converts your height to feet and inches. Have the program use the underscore character to indicate where to type the response. Also use a const symbolic constant to represent the conversion
factor.
Explanation:
Below mention code is compiled in Visual Studio 2015 and Code Blocks 13.12,output snap is attached.. If any problem you feel and you want some explanation feel free to contact us.
Code:
/**************************************************|
/*************C++ Programs And Projects************|
***************************************************/
#include <iostream>
using namespace std;
void main() {
cout << "Enter your height (in
inches): ________\b\b\b\b\b\b\b\b";
int height;
cin >> height;
const int inchesPerFoot = 12;
int feet = height / inchesPerFoot;
int inches = height % inchesPerFoot;
cout << height<< " inches are "<< feet<< " feet, "<< inches<< " inch(es)."<< endl;
}
Output:
Related Articles:
0 Questions:
Post a Comment