Pagini recente » Cod sursa (job #1568088) | Cod sursa (job #489186) | Cod sursa (job #1668315) | Cod sursa (job #3258193) | Cod sursa (job #943310)
Cod sursa(job #943310)
#include<fstream>
using namespace std;
ifstream f("algsort.in");
ofstream g("algsort.out");
void citire(long long a[256000],long long n)
{int i;
for(i=1;i<=n;i++)
{f>>a[i];}}
int main()
{long long a[256000],ok=1,n,i,j,aux;
f>>n;
citire(a,n);
while(ok==1)
{ok=0;
for(i=1;i<=n-1;i++)
{if(a[i]>a[i+1])
{aux=a[i];
a[i]=a[i+1];
a[i+1]=aux;
ok=1;}}}
for(i=1;i<=n;i++)
{g<<a[i]<<" ";}}