cc++重要函数总结

xiaoxiao2021-02-28  90

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];

转载请注明原文地址: https://www.6miu.com/read-63771.html

最新回复(0)