Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "");
- srand(time(0));
- string a;
- int i, j, number;
- char bukva;
- for (i = 0; i < 30; i++) {
- number = 97 + rand() % 26;
- bukva = (char)number;
- a += bukva;
- }
- cout << "Исходный массив:\n";
- cout << a << endl;
- for (i = 1; i < 30; i++) {
- for (j = 0; j < 29; j++) {
- if (a[i] < a[j]) {
- bukva = a[i];
- a[i] = a[j];
- a[j] = bukva;
- }
- }
- }
- cout << "Отсортированный массив:\n";
- cout << a << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement