Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <locale.h>
- const int n=3;
- int main()
- {
- setlocale(LC_ALL,"RUS");
- char imya[n][10],temp[10];
- int i=0,j;
- printf("Введи 3 имени и я отсортирую их:\n");
- while (i<n)
- {
- gets(imya[i]);
- i++;
- }
- for (i=0;i<n;i++)
- for(j=0;j<n;j++)
- {
- if(imya[i][0]<imya[j][0] && imya[i][1]<imya[j][1] && imya[i][2]<imya[j][2])
- {
- strcpy(temp,imya[i]);
- strcpy(imya[i],imya[j]);
- strcpy(imya[j],temp);
- }
- }
- for (i=0;i<n;i++)
- puts(imya[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement