strcmp.c
来自「c21Examples.rar」· C语言 代码 · 共 33 行
C
33 行
/* The strcmp() function. */
#include <stdio.h>
#include <string.h>
int main( void )
{
char str1[80], str2[80];
int x;
while (1)
{
/* Input two strings. */
printf("\n\nInput the first string, a blank to exit: ");
gets(str1);
if ( strlen(str1) == 0 )
break;
printf("\nInput the second string: ");
gets(str2);
/* Compare them and display the result. */
x = strcmp(str1, str2);
printf("\nstrcmp(%s,%s) returns %d", str1, str2, x);
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?