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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s