//program 2.4 - using const

2017-03-25  本文已影响0人  Zdhj

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

}

上一篇 下一篇

猜你喜欢

热点阅读