1: #include<stdio.h>
2: #include<conio.h>
3: #include<string.h>
4: void main()
5: { 6: char str1[40];
7: char str2[40];
8: int n;
9: printf("Enter the first string:\n"); 10: gets(str1);
11: printf("Enter the second string:\n"); 12: gets(str2);
13: n=strcmp(str1,str2);
14: if(n==0)
15: { 16: printf("the strings are identical\n"); 17: }
18: else
19: { 20: printf("if sorted alphabetically the strings will come in following order\n"); 21: }
22: if(n<0)
23: { 24: puts(str1);
25: puts(str2);
26: }
27: if(n>0)
28: { 29: puts(str2);
30: puts(str1);
31: }
32: getch();
33: }
No comments:
Post a Comment