# ctype.h
//判断字母
isalpha('a')
//是否是数字、字母
isalnum('a')
//判断大写字母
isupper('a')
//转换
toupper('a')
//判断小写字母
islower('a')
//转换
tolower('A')
//判断数字
isdigit('7')
//空格
isspace(' ')
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# math.h
//double
//向上取整(进一)
ceil(double)
//向下取整(舍去)
floor(double)
//平方根
sqrt(double)
//n次方
double pow(double,double)
//绝对值
int abs(int)
//e的x次方
exp(x)
//
log(x)
log10(x)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 随机数
//设置随机数种子
srand(1);
//生成随机数
printf("%d",rand());
//随机数种子相同,生成相同随机数
srand(1);
printf("%d",rand());
1
2
3
4
5
6
7
2
3
4
5
6
7
# 字符串处理
# strcpy:将一个字符串内容复制到一个字符串数组中
//会覆盖掉c1的内容
char c1[20] = "11";
char c2[3] = "122222";
stpcpy(c1, c2);
printf("%s",c1);//122222
1
2
3
4
5
6
2
3
4
5
6
# strlen:获取字符数组中字符串长度
char c1[20] = "1234";
strlen(c1);//4
1
2
2
# strcat:合并两个字符数组
char c1[20] = "1234 null";
char c2[10] = "222";
strcat(c1, c2);
printf("%s",c1);//1234 null222
1
2
3
4
2
3
4
# atio:字符串转整形
int atio(const char* char);
1
# strcmp:字符串比较
int strcmp (const char* str1,const char* str2)
1
firewall →