Pagini recente » Istoria paginii runda/oji_9_12111 | Atasamentele paginii eu_cu_florinas | Istoria paginii runda/oni2018ziua1/clasament | Istoria paginii runda/oji2006/clasament | Cod sursa (job #1982034)
#include <fstream>
using namespace std;
ifstream fin("algsort.in");
ofstream fout("algsort.out");
int n, v[500005];
void read()
{
fin >> n;
for( int i = 0; i < n; i++)
fin >> v[i];
}
void bubblesort()
{
for(int i = 0; i < n-1; i++)
{
for(int j = i + 1; j < n; j++)
{
if( v[j] < v[i])
swap(v[i],v[j]);
}
}
}
void write()
{
for(int i = 0; i < n; i++)
fout << v[i] << " ";
fout << endl;
}
int main()
{
read();
//write();
bubblesort();
write();
fin.close();
fout.close();
}