Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void buborek(int a[],int n)
- {
- bool f=1;
- while(f)
- {
- f=0;
- for(int i=0;i<n-1;i++)
- {
- if(a[i+1]<a[i])
- {
- a[i+1]=a[i+1]+a[i];
- a[i]=a[i+1]-a[i];
- a[i+1]=a[i+1]-a[i];
- f=1;
- }
- }
- }
- return;
- }
- int main()
- {
- int a[10000],i=0;
- ifstream fin("DATE.TXT");
- while(fin.eof()==0)
- {
- fin>>a[i];
- i++;
- }
- fin.close();
- ofstream fout("OUT.TXT");
- buborek(a,i);
- for(int j=0;j<i;j++)
- fout<<a[j]<<" ";
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement