c/c++重要函数总结

来源:互联网 发布:js防水涂料 施工方法 编辑:程序博客网 时间:2024/06/16 03:41

1、strcmp函数

i=strcmp(字符串,字符串); 其中,字符串1、字符串2均可为字符串常量或变量;i   是用于存放比较结果的整型变量

①字符串1小于字符串2,strcmp函数返回一个负值;②字符串1等于字符串2,strcmp函数返回零;③字符串1大于字符串2,strcmp函数返回一个正值;

struct Student{

     char no[100];

     int age;

     bool operator < (const Student & A) const{

         return strcmp ( no ,A.no) < 0

     }

}buf[1000];