Cod sursa(job #1050571)
Utilizator | Data | 8 decembrie 2013 19:00:58 | |
---|---|---|---|
Problema | Sortare prin comparare | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <iostream>
#include<fstream>
#include<stdlib.h>
using namespace std;
ifstream f("algsort.in");
ofstream g("algsort.out");
int comp(const void *a, const void *b)
{
return (*(int*)a-*(int*)b);
}
int main()
{
int n,i, v[500000];
f>>n;
for(i=0;i<n;i++)
f>>v[i];
qsort(v,n,sizeof(int),comp);
for(i=0;i<n;i++)
g<<v[i];
return 0;
}