|
#include "stdafx.h"
int main()
{
int a[10] = {4,7,1,0,9,6,5,3,2,8};
for(int i=0;i<10;++i)
{
int temp;
if(a[0] <a[i])
{
temp = a[0];
a[0] = a[i];
a[i] = temp;
}
if(a[9]> a[i])
{
temp = a[9];
a[9] = a[i];
a[i] = temp;
}
}
for(int i=0;i<10;i++)
cout<<a[i]<<endl;
} |
|