第一题//求5个数的最小值
#include<iostream>
using namespace std;
int main()
{
int z,x,c,v,b,n;
cin>>z>>x>>c>>v>>b;
n = z;
if(n>x)
{
n=x;
}
if(n>c)
{
n=c;
}
if(n>v)
{
n=v;
}
if(n>b)
{
n=b;
}
cout<<n;
return 0;
}
第二题//输入 a b 要求交换数据后输出
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b;
c = a;
a = b;
b = c;
cout<<a<<" "<<b;
return 0;
}
3
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,jjj;
cin>>a>>b>>c>>d>>e;
if(a<b)
{
jjj=a;
a=b;
b=jjj;
}
if(b<c)
{
jjj=b;
b=c;
c=jjj;
}
if(c<d)
{
jjj=c;
c=d;
d=jjj;
}
if(d<e)
{
jjj=d;
d=e;
e=jjj;
}
if(a<b)
{
jjj=a;
a=b;
b=jjj;
}
if(b<c)
{
jjj=b;
b=c;
c=jjj;
}
if(c<d)
{
jjj=c;
c=d;
d=jjj;
}
if(a<b)
{
jjj=a;
a=b;
b=jjj;
}
if(b<c)
{
jjj=b;
b=c;
c=jjj;
}
if(a<b)
{
jjj=a;
a=b;
b=jjj;
}
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
return 0;
}