Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int i=0,j=0,k,l,len=0,count=0;
- int lenTemp[10],temp;
- char names[100][11];
- char input[20];
- char tempChar[11],tempChar2[11];
- for(i=0;i<=9;i++)
- {
- scanf("%s",input);
- len = 0;
- while(input[len]!='\0')
- {
- len += 1;
- }
- lenTemp[i] = len;
- for(j=0;j<=len-1;j++){
- names[j][i] = input[j];
- }
- names[j+1][i] = ':';
- }
- for(i=0;i<=9;i++)
- {
- tempChar[i] = names[0][i];
- tempChar2[i] = names[1][i];
- }
- for(i=0;i<=8;i++)
- {
- for(j=0;j<=8;j++)
- {
- if(tempChar[j]>tempChar[j+1])
- {
- temp = tempChar[j];
- tempChar[j] = tempChar[j+1];
- tempChar[j+1] = temp;
- temp = tempChar2[j];
- tempChar2[j] = tempChar2[j+1];
- tempChar2[j+1] = temp;
- }
- }
- }
- for(i=0;i<=9;i++){
- for(j=0;j<=9;j++){
- if(names[0][j] == tempChar[i]){
- while(count<=lenTemp[j]-1)
- {
- printf("%c",names[count][j]);
- count += 1;
- }
- count = 0;
- printf("%c%d\n",':',j+1);
- }
- }
- }
- printf("\n");
- printf("Message : ");
- for(i=0;i<=9;i++) printf("%c",tempChar2[i]);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement