上一页 1 ··· 28 29 30 31 32
  2021年7月28日
摘要: 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! 阅读(54) 评论(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! 阅读(45) 评论(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! 阅读(141) 评论(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! 阅读(125) 评论(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! 阅读(1107) 评论(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! 阅读(188) 评论(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! 阅读(113) 评论(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! 阅读(65) 评论(0) 推荐(0) 编辑
摘要: //指向结构的指针 struct结构名称 *结构指针变量名 //(*结构指针变量名).成员变量名//结构指针变量->成员变量名 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 6 struct Martial //门 阅读全文
posted @ 2021-07-28 08:20 Bytezero! 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 一只小猴子一天摘了许多桃子,第一天吃了一半,然后忍不住又吃了一个;第二天又吃了一半,再加上一个;后面每天都是这样吃。到第10天的时候,小猴子发现只有一个桃子了。问小猴子第一天共摘了多少个桃子。 1 #include<stdio.h> 2 3 int main() 4 { 5 int i = 1; 6 阅读全文
posted @ 2021-07-28 08:00 Bytezero! 阅读(142) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32