Cod sursa(job #1710831)
| Utilizator | Data | 29 mai 2016 20:40:44 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <fstream>
#include <iostream>
using namespace std;
const int maxn = 1005;
int n, v[maxn];
int main() {
ifstream fin("algsort.in");
ofstream fout("algsort.out");
fin >> n;
for(int i = 0; i < n; ++ i)
fin >> v[i];
for(int i = 0; i + 1 < n; ++ i)
for(int j = i + 1; j < n; ++ j)
if(v[i] > v[j])
swap(v[i], v[j]);
for(int i = 0; i < n; ++ i)
fout << v[i] << ' ';
}
