鱼C论坛

 找回密码
 立即注册
查看: 1829|回复: 3

三个数比大小

[复制链接]
发表于 2022-2-6 15:00:52 | 显示全部楼层
#include <iostream>
using namespace std;
int main()
{
        int m, n, x,temp;
        cout << "本程序用于输入三个数,将其从小到大输出" << endl;
        cout << "请输入三个整数:" << endl;
        cin >> m >> n >> x;
        if (m > n)
        {
                temp = m;
                m = n;
                n = temp;
        }
        if (n > x)
        {
                temp = n;
                n = x;
                x = temp;
        }
        cout << "三个数从小到大依次为:" << m <<" " << n << " " << x << endl;
}
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-9-19 04:14

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表