Cod sursa(job #243690)

Utilizator cvicentiuCiorbaru Vicentiu Marian cvicentiu Data 13 ianuarie 2009 20:37:49
Problema Sortare prin comparare Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <fstream>
using namespace std;
fstream fin ("algsort.in",ios::in);
fstream fout("algsort.out",ios::out);
unsigned int v[500001],n;
int main(){
	fin>>n;
	unsigned int aux;
		for (unsigned int i=1;i<=n;i++)
			fin>>v[i];

	for(unsigned int i=1;i<=n;i++)
		for(unsigned int j=i+1;j<=n;j++)
			if (v[i]>v[j]) {
				aux=v[i];
				v[i]=v[j];
				v[j]=aux;
			}
		for (unsigned int i=1;i<=n;i++)
			fout<<v[i]<<" ";
	
}