用c++求 一直两个变量 写一些一条简单的if语句,把较小的值赋给较大的变量。

2025-06-28 19:07:47
推荐回答(5个)
回答1:

#include
using namespace std;
int main()
{
int x,y,t;
cout<<"enter the original number x,y :";
cin>>x>>y;
if(x>y)
{t=y;
y=x;
x=t;
cout<<"the changed numbers :"<else
cout<<"the changed numbers :"<return 0;

}

回答2:

a>b?a=b:b=a如果a>b a就=b否则b=a

回答3:

int a=5;int b=6;if(ab=a-b;
a=a-b;}

回答4:

if(a > b){ t=a;a=b;b=t;}

回答5:

int a = n;int b = k;if(a>b){ a=b;}else{ b=a;}