LordMirai

Problema pitic

Jan 25th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. void SirCrescator() {
  2. cout << "Scrie ceva: ";
  3. char input[300];
  4. cin >> input;
  5. int len = strlen(input);
  6. cout << "\nSirul de caractere introdus: " << input << endl << endl;
  7. for (int t = 0; t <= len - 1; t++)
  8. {
  9. for (int i = 0; i <= len - 1; i++)
  10. {
  11. if (int(input[i]) > int(input[i + 1])) {
  12. swap(input[i], input[i + 1]);
  13. }
  14. }
  15. }
  16. cout << "Sirul ordonat este: ";
  17. for (int i = 0; i <= len; i++) {
  18. cout << input[i] << " ";
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment