Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by dsadsa ( 11 years ago )
#include <fstream>
using namespace std;
ifstream fin("halfsort.in");
ofstream fout("halfsort.out");
int main()
{int n,A[101];
fin>>n;
for(int i=1;i<=n;i++)
fin>>A[i];
for(int i=1;i<=n/2;i++)
for(int j=i+1;j<=n/2;j++)
{if (A[i]>A[j]) {int aux=A[i];
A[i]=A[j];
A[j]=aux;}}
for(int i=n/2+1;i<n;i++)
for(int j=i+1;j<=n;j++)
{if (A[i]<A[j]) {int aux=A[j];
A[j]=A[i];
A[i]=aux;}}
for(int i=1;i<=n;i++)
fout<<A[i]<<" ";
return 0;}
Revise this Paste