编程语言
首页 > 编程语言> > 程序清单2.6 convert.cpp

程序清单2.6 convert.cpp

作者:互联网

// convert.cpp -- converts stone to pounds

#include <iostream>

int stonetolb(int);

int main()
{
    using namespace std;

    int stone;
    cout << "Enter the weight in stone: ";
    cin >> stone;
    int pounds = stonetolb(stone);
    cout << stone << " stone = ";
    cout << pounds << " pounds." << endl;

    return 0;
}

int stonetolb(int sts)
{
    return 14 * sts;
}

输出:

Enter the weight in stone: 12
12 stone = 168 pounds.

 

标签:convert,cout,pounds,int,stone,stonetolb,cpp,程序清单
来源: https://blog.csdn.net/m0_38101326/article/details/88044615