c++ strcmp函数

用法:加头文件 #include <string.h>

     功能:比较字符串s1和s2。

  一般形式:strcmp(字符串1,字符串2)

  返回值:

  当s1<s2时,返回值<0

  当s1=s2时,返回值=0

  当s1>s2时,返回值>0

  即:两个字符串自左向右逐个字符相比(按ASCII值大小相比较),直到出现不同的字符或遇'\0'为止。如:"A"<"B" "a">"A" "computer">"compare"

posted @ 2018-03-30 21:59  Mr^Simon  阅读(1837)  评论(0编辑  收藏  举报