2021年7月28日
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 //字符串和字符数组的区别:最后一位是否是 \0,空字符 有的为 字符串 没有的 为字数组 6 //所有的字符串都是字符数组 对的 7 //所有的字符数组都是字符串 错的. 8 / 阅读全文
posted @ 2021-07-28 09:40 Bytezero! 阅读(443) 评论(0) 推荐(0)
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 //返回传入字符串的长度 6 int GetStrLength(char[]); 7 8 //封装fgets<用来接收字符串的字符数组,接收的字符总数 9 void G 阅读全文
posted @ 2021-07-28 09:32 Bytezero! 阅读(147) 评论(0) 推荐(0)
摘要: 1 //内置函数 strlen 2 //计算字符串的实际长度,不含字符串结束标准\0 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 void main() 9 { 10 11 char words1[] = { 阅读全文
posted @ 2021-07-28 09:30 Bytezero! 阅读(64) 评论(0) 推荐(0)
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 6 void main() 7 { 8 9 char str1[50]; 10 char str2[20]; 11 printf("输入目的字符串:"); 12 get 阅读全文
posted @ 2021-07-28 09:25 Bytezero! 阅读(55) 评论(0) 推荐(0)
摘要: 1 //内置函数 字符串比较 strcmp 2 // 原理:将两个字符串从首字母开始,按照ASCII码的顺序逐个比较 3 //字符串1 == 字符串2 返回0 4 //字符串1 < 字符串2, 返回正数 5 //字符串1 > 字符串2 ,返回负数 6 7 #include<stdio.h> 8 #i 阅读全文
posted @ 2021-07-28 09:20 Bytezero! 阅读(160) 评论(0) 推荐(0)
摘要: 1 //字符串连接 strcat 2 //将一个字符串连接到另一个字符串的末尾,组合成一个新字符串 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 void main() 9 { 10 char str1[200 阅读全文
posted @ 2021-07-28 09:10 Bytezero! 阅读(136) 评论(0) 推荐(0)
摘要: //实现字符串的加密与解密//加密方式:将字符串中每个字符加上它在字符中的位置和一个偏移量 5//列如:zhnglie中,第一个字符z在字符中的位置为0,那么对应密文是'm'+0+5 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string 阅读全文
posted @ 2021-07-28 09:00 Bytezero! 阅读(1237) 评论(0) 推荐(0)
摘要: 1 //指向字符串的指针 也可以指向常量 也可以指向储存字符串的数组 2 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 int main () 9 { 10 //2. 11 // printf("%p\n",* 阅读全文
posted @ 2021-07-28 08:59 Bytezero! 阅读(203) 评论(0) 推荐(0)
摘要: 1 //结构体 结构时一种构造数据类型,由若干数据项组合而成 2 3 //1.结构定义并不预留内存 2.结构定义一般放在程序的开始部分(头文件声名之后) 4 //3.结构定义仅用来描述结构的形式,使用结构需要声名结构变量 5 6 7 #include<stdio.h> 8 #include<stdl 阅读全文
posted @ 2021-07-28 08:55 Bytezero! 阅读(131) 评论(0) 推荐(0)
摘要: 1 //玩家 Player 2 //玩家有属性门派(种族,阵营) 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 struct Martial //门派 9 { 10 int id; //门派 id 11 cha 阅读全文
posted @ 2021-07-28 08:30 Bytezero! 阅读(75) 评论(0) 推荐(0)