25 by clamitze

VIEWS: 18 PAGES: 1

									#include<fstream.h> #include<conio.h> void main() {int n; cout<<"cate numere vrei sa sortezi ? "<<endl; cin>>n; int i,gasit,man; long int numere[10]; ifstream f("nr.in"); for(i=1;i<=n;i++) f>>numere[i]; do {gasit=0; for(i=1;i<=n;i++) if(numere[i]>numere[i+1]){man=numere[i];numere[i]=numere[i+1];numere[i+1] =man;gasit=1;}} while(gasit); ofstream fo("nr.out"); for(i=1;i<=n;i++) fo<<numere[i]<<" ";}


								
To top