Foxyzboi

Untitled

Dec 9th, 2021 (edited)
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int temp;
  9.     const int size = 30;
  10.     char str[size];
  11.     for (int i = 0; i < size; i++) {
  12.         cin >> str[i];
  13.     }
  14.     for (int i = 0; i < size; i++) {
  15.         for (int j = i+1; j < size - 1; j++) {
  16.             if (str[i] > str[j])
  17.             {
  18.                 temp = str[i];
  19.                 str[i] = str[j];
  20.                 str[j] = temp;
  21.             }
  22.         }
  23.     }
  24.     cout << endl;
  25.     for (int i = 0; i < size; i++) {
  26.         cout << str[i];
  27.     }
  28. }
Add Comment
Please, Sign In to add comment