Crazy

sortiranje na zborovi

Dec 14th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2. int main(){
  3.   int i,j,n;
  4.   char str[10][100],temp[100];
  5.   for(i=0;i<10;i++)
  6.       gets(str[i]);
  7.   for(i=0;i<9;i++)
  8.       for(j=i+1;j<10;j++){
  9.            if(strcmp(str[i],str[j])>0){
  10.                strcpy(temp,str[i]);
  11.               strcpy(str[i],str[j]);
  12.               strcpy(str[j],temp);
  13.            }
  14.       }
  15.  
  16.   for(i=0;i<10;i++)
  17.       puts(str[i]);
  18.   return 0;
  19. }
Add Comment
Please, Sign In to add comment