C++ Primer Plus Sixth Edition Programming Exercises---Chapter 3 Handling Data (To be continued)

1.

#include <iostream>

const int CONVER_FACTOR = 12;

int main(int argc, char* argv[])
{
int height = 0;
std::cout << "Pleas enter your height with inch_ ";
std::cin >> height;
if(0 > height)
{
std::cout << "Pleas enter your height with inch_ ";
std::cin >> height;
}
std::cout << "You are " << height/CONVER_FACTOR << " foots and " << height%CONVER_FACTOR << " inches." << std::endl;
return 0;

}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324933247&siteId=291194637