美文网首页
//program 2.4 - using const

//program 2.4 - using const

作者: Zdhj | 来源:发表于2017-03-25 13:39 被阅读0次

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

    }

    相关文章

      网友评论

          本文标题://program 2.4 - using const

          本文链接:https://www.haomeiwen.com/subject/mblcottx.html