Cod sursa(job #364892)

Utilizator Hori93Simon Horatiu Hori93 Data 17 noiembrie 2009 12:45:57
Problema Sortare prin comparare Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.6 kb
// By Sw33T j0k3R ( hori93 ) -> CNLR BISTRITA

#include<fstream>
using namespace std;

ifstream fin("algsort.in");
ofstream fout("algsort.in");



int Sort(int a[40], int n )
{
    int aux;
	for (int i = 0 ; i < n - 1 ; i++)
		for (int j = i +1 ; j < n ; j++ )
		 if ( a[i] > a[j] )
		 {
			aux = a[i];
			a[i] = a[j];
			a[j] = aux;
        }
        return aux;    
}

int main()
{
	int x[40],n,i;

	fin >> n;

	for ( i = 0 ; i < n ; i++ )
	fin >> x[i];

	fout << Sort(x , n);

    fin.close();
    fout.close();
	return 0;
}
// By Sw33T j0k3R ( hori93 ) -> CNLR BISTRITA