- #include <stdio.h>
- void main()
- {
- char str[40];
- int cmp( char *str1, char *str2 );
- printf("Please enter the people you like the best : ");
- scanf("%s", str);
- #ifndef CORRECT
- #define CORRECT "sunshine429"
- #endif
- if( cmp( str, CORRECT ) == 0 )
- {
- printf("\nYeah! You are a smart man!\n\n");
- }
- else
- {
- printf("\nYou fool! Man!!\n\n");
- }
- }
- int cmp( char *str1, char *str2 )
- {
- int i = 0, j = 0;
- while( str1[i] )
- {
- while( str2[j] == str1[i] )
- {
- i++;
- j++;
- if( !str2[j] )
- {
- return 0;
- }
- }
- j = 0;
- i++;
- }
- return -1;
- }
复制代码 |
|