acm练习(一)

acm 练习(一)

//5个数中的最大值,最小值
#include<iostream>
using namespace std;
void sore(int a[5])
{
for(int i=0;i<5;i++)
for(int j=i;j<5;j++)
{
if(a[i]>a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
int main()
{
int a[5];
for(int m=0;m<5;m++)
{
cin>>a[m];
}
sore(a);
cout<<a[0]<<" "<<a[4];
}

未通过。。。。。

本性的苏醒,往往在遭遇真实之后。
原文地址:https://www.cnblogs.com/chance88/p/4354682.html