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]%10<a[i]%10)
- {
- 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;
- }
- }
- }
- }
- int main()
- {
- int n,a[10001];
- ifstream fin("DATE.TXT");
- fin>>n;
- for(int i=0;i<n;i++)
- {
- fin>>a[i];
- }
- fin.close();
- buborek(a,n);
- for(int i=0;i<n;i++)
- cout<<a[i]<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement