Advertisement
ZhilinskiyG

Metod (Probnik)

Mar 24th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int i = 0;
  7.     int mas[10];
  8.     while (i < 10){
  9.         cin >> mas[i];
  10.         i++;
  11.     }
  12.     i = 0;
  13.     int d=0;
  14.     while (i<10)
  15.     {
  16.         int j = 0;
  17.         while (j < 9)
  18.         {
  19.             if (mas[j] > mas[j + 1]){
  20.                 d = mas[j];
  21.                 mas[j] = mas[j + 1];
  22.                 mas[j + 1] = d;
  23.             }
  24.             j++;
  25.         }
  26.         i++;
  27.     }
  28.    
  29.    
  30.    
  31.     i = 0;
  32.     while (i < 10){
  33.         cout << mas[i]<<" ";
  34.         i++;
  35.     }
  36.     cout << endl;
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement