1.cmath//数学函数,有sqrt(开方)等函数
2.对于字符串的函数库
strncmp
strncmp函数为字符串比较函数,字符串大小的比较是以ASCII 码表上的顺序来决定,此顺序亦为字符的值。其函数声明为int strncmp ( const char * str1, const char * str2, size_t n );功能是把 str1 和 str2 进行比较,最多比较前 n 个字节,若str1与str2的前n个字符相同,则返回0;若s1大于s2,则返回大于0的值;若s1 小于s2,则返回小于0的值。
#include<iostream>
#include<string>
using namespace std;
int main() {
char a[] = "aad";
char b[] = "aaa";
// cin<<a<<b;
int re = 0;
re = strncmp(a, b, 2);
cout << re;
return 0;
}
如果使用string类,可以使用#include 里的如下方法进行大小写转换;
transform(str.begin(),str.end(),str.begin(),::tolower);