Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int temp;
- const int size = 30;
- char str[size];
- for (int i = 0; i < size; i++) {
- cin >> str[i];
- }
- for (int i = 0; i < size; i++) {
- for (int j = i+1; j < size - 1; j++) {
- if (str[i] > str[j])
- {
- temp = str[i];
- str[i] = str[j];
- str[j] = temp;
- }
- }
- }
- cout << endl;
- for (int i = 0; i < size; i++) {
- cout << str[i];
- }
- }
Add Comment
Please, Sign In to add comment