strcmp函数
strcmp函数比较两个字符串是否相等;
使用方法:
int strcmp ( const char * str1, const char * str2 );举个例子,在网上看到的:
/* strcmp example */
#include <stdio.h>
#include <string.h>
int main ()
{
  char szKey[] = "apple";
  char szInput[80];
  do {
     printf ("Guess my favourite fruit? ");
     gets (szInput);
  } while (strcmp (szKey,szInput) != 0);
  puts ("Correct answer!");
  return 0;
}结果:

                    
                
                
            
        
浙公网安备 33010602011771号