C++语言开发示例:01. 余数

2024-07-11 10:16:34 2025-02-01 20:23:27 李腾 25 次阅读 0 次点赞

modulus.cpp

#include <iostream>

int main()
{
    using namespace std;
    const int Lbs_per_stn = 14;
    int lbs;

    cout << "Enter your weight in pounds: ";
    cin >> lbs;
    int stone = lbs / Lbs_per_stn;
    int pounds = lbs % Lbs_per_stn;
    cout << "lbs"
         << " pounds are " << stone
         << " stone, " << pounds << " pound(s).\n";
}
本文由人工编写,AI优化,请仔细甄别,转载请注明转自www.hylab.cn,原文地址:C++语言开发示例:01. 余数

评论 (0)

登录后发表评论

暂无评论,快来发表第一条评论吧!