SHARE
TWEET

Untitled

a guest Dec 6th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <locale.h>
  5. const int n=3;
  6. int main()
  7. {
  8. setlocale(LC_ALL,"RUS");
  9. char imya[n][10],temp[10];
  10. int i=0,j;
  11. printf("Введи 3 имени и я отсортирую их:\n");
  12. while (i<n)
  13. {
  14. gets(imya[i]);
  15. i++;
  16. }
  17. for (i=0;i<n;i++)
  18. for(j=0;j<n;j++)
  19. {
  20. if(imya[i][0]<imya[j][0] && imya[i][1]<imya[j][1] && imya[i][2]<imya[j][2])
  21. {
  22. strcpy(temp,imya[i]);
  23. strcpy(imya[i],imya[j]);
  24. strcpy(imya[j],temp);
  25. }
  26. }
  27. for (i=0;i<n;i++)
  28. puts(imya[i]);
  29. return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top