Pagini recente » Cod sursa (job #2557777) | Cod sursa (job #2681694) | Cod sursa (job #719987) | Cod sursa (job #2907068) | Cod sursa (job #782753)
Cod sursa(job #782753)
// Sortare prin Comparare.cpp : Defines the entry point for the console application.
//
#ifdef WIN32
#include "stdafx.h"
#endif
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
std::vector<int> v;
int main()
{
ifstream fin("algsort.in");
ofstream fout("algsort.out");
int n, x;
for(fin >> n; n; n--) {
fin >> x;
v.push_back(x);
}
sort(v.begin(), v.end());
for(int i = 0; i < v.size(); i++)
fout << v[i] << ' ';
fout.close();
fin.close();
return 0;
}