1、strcpy(第一个参数是被写入的字符串头指针,第二个参数是读的字符串头指针)
//1、strcpy(数组2,被复制的数组1)
int main(){
char arr1[5]={0};
char arr2[5]={0};
while(cin>>arr1){
strcpy(arr2,arr1);
cout<<arr1<<endl;
cout<<arr2;
}
return 0;
}
2、sqrt 传参浮点数,返回值也是浮点数
//sqrt:计算算术平方根
int main(){
double x = 2;
cout<<sqrt(x)<<endl;
return 0;
}
//输出1.41421
3、double pow(double a, double b) 返回a^b的浮点数
int main(){
double x = 2;
cout<<pow(x,3)<<endl;
return 0;
}//输出8
4、ceil、floor、round
-
double ceil(double x) 返回x的向上取整的值
-
double floor(double x) 返回x的向下取整的值
-
double round(double x) 返回x四舍五入的值
int main(){
double x = 2.5;
cout<<floor(x)<<" "<<ceil(x)<<" "<<round(x)<<endl;
return 0;
}//2 3 3
5、abs与fabs(针对double) 取绝对值
double x = -2.5;
cout<<abs(x)<<endl;
//输出2.5
6、isalnum、islower、isupper,分别检查是否是字母数字、是否是小写字母、是否是大写字母