C++ Primer Plus Chapter 3 Exercise 1

c plus plusChapter 3 begins with a  problem that ask you do some more conversion. Let’s see my solution:

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

#include <iostream>

using namespace std;

int main()
{
const int feet = 12;
int inches;

cout << "Enter your height in inches: " << endl;
cin >> inches;

cout << "Your height is " << inches/feet << " and " << inches%feet << " inches" << endl;

return 0;
}