C++ Arithmetic Operator Converting a length in inches to feet-and-inches.
#include <iostream> int main(){/*from w w w . java 2 s.c o m*/ const int inches_per_foot = 12; long length_inches = 0; std::cout << "Please enter the number of inches: "; std::cin >> length_inches; long feet = length_inches / inches_per_foot; long inches = length_inches % inches_per_foot; std::cout << "In " << length_inches << " inches there are " << feet << " feet and " << inches << " inch(es)." << std::endl; }