c++中strcmp函数怎么使用

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 15:32:36
c++中strcmp函数怎么使用
xNA_e.osR)m3+jBfp vJc:);n:B 'KsxfPz/KA¶4<uA0!*t5Y .A*)bau\KA+Jf^GM13U4 gy!Q/oavlNև

c++中strcmp函数怎么使用
c++中strcmp函数怎么使用

c++中strcmp函数怎么使用
strcmp
Syntax:
#include
int strcmp( const char *str1,const char *str2 );
The function strcmp() compares str1 and str2,then returns:
Return value Explanation
less than 0 str1 is less than str2
equal to 0 str1 is equal to str2
greater than 0 str1 is greater than str2
For example:
printf( "Enter your name:" );
scanf( "%s",name );
if( strcmp( name,"Mary" ) == 0 )
printf( "Hello,Dr.Mary!\n" );