Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- unsigned short n;
- cout << "n = ";
- cin >> n;
- float* mas = new float[n];
- for (int i = 0; i < n; i++)
- cin >> mas[i];
- for(int i=0 ; i < n ; i++)
- cout << mas[i] << " " ;
- cout << endl;
- for(int i=0; i < n; i ++){
- for(int j=0 ; j < n-1 ; j++){
- if(mas[j] > mas[j+1]){
- int t=mas[j];
- mas[j]=mas[j+1];
- mas[j+1]=t;
- }
- }
- }
- for(int i=0; i < n ; i++)
- cout << mas[i] << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement