//program 2.4 - using const
include<iostream>//for output to the screen
using namespace std;
int main(){
const int inches_per_foot = 12;
const int feet_per_yard = 3;
int yards = 0;
int feet = 0;
int inches = 0;
//read the length from the keyboard
cout << "enter a length as yards , feet , an inches : ";
cin >> yards >> feet >> inches;
//output the length in inches
cout << endl << "length is inches is " << inches + inches_per_foot*(feet + feet_per_yard*yards) << endl;
return 0;
}
网友评论