Cod sursa(job #782753)

Utilizator predator5047Butiu Alexandru Octavian predator5047 Data 29 august 2012 18:08:46
Problema Sortare prin comparare Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
// 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;
}