上一页 1 ··· 274 275 276 277 278 279 280 281 282 ··· 367 下一页
摘要: c语言中实现字符串大小写的转换。 1、 #include <stdio.h> #include <ctype.h> void str_toupper(char x[]) { int i = 0; while(x[i]) { x[i] = toupper(x[i]); i++; } } void st 阅读全文
posted @ 2021-05-26 16:52 小鲨鱼2018 阅读(2278) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void rev_put(char x[]) { int i, len = 0; while(x[len]) len++; for(i = 0; i < len / 2; i++) { char tmp = x[i]; x[i] = x[len - 1 - 阅读全文
posted @ 2021-05-26 16:34 小鲨鱼2018 阅读(40) 评论(0) 推荐(0) 编辑
摘要: c语言中统计字符串中数字字符出现的次数。 1、 #include <stdio.h> void int_count(char x[], int cnt[]) { int i; while(x[i]) { if(x[i] >= '0' && x[i] <= '9') { cnt[x[i] - '0'] 阅读全文
posted @ 2021-05-26 16:06 小鲨鱼2018 阅读(1678) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void put(char x[]) { int len = 0; while(x[len]) len++; int i = 0; while(x[i]) { putchar(x[len - 1 - i++]); } putchar('\n'); } in 阅读全文
posted @ 2021-05-26 13:13 小鲨鱼2018 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void put(char x[], int n) { while(n-- > 0) printf(x); putchar('\n'); } int main(void) { char str[128]; int n; printf("str: "); s 阅读全文
posted @ 2021-05-26 12:34 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑
摘要: c语言中使用putchar显示字符串 1、 #include <stdio.h> int put(char x[]) { int i = 0; while(x[i]) putchar(x[i++]); } int main(void) { char str[128]; printf("str: ") 阅读全文
posted @ 2021-05-26 12:23 小鲨鱼2018 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int search(char x[], int c) { int i = 0, j = 0; while(1) { if(x[i] == c) { j++; } if(x[i] == '\0') break; i++; } return j == 0 ? 阅读全文
posted @ 2021-05-26 11:38 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 1、线性查找法 #include <stdio.h> #define FAILED -1 int len(char x[]) { int len = 0; while(x[len]) len++; return len; } int search(char x[], char key) { int 阅读全文
posted @ 2021-05-25 23:02 小鲨鱼2018 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void null_string(char x[]) { x[0] = '\0'; } int main(void) { char str[128]; printf("str: "); scanf("%s", str); printf("begin: %s 阅读全文
posted @ 2021-05-25 22:10 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑
摘要: c语言中输出字符串的长度。 1、 #include <stdio.h> int str_len(const char x[]) { int len = 0; while(x[len]) len++; return len; } int main(void) { char str[100]; prin 阅读全文
posted @ 2021-05-25 21:56 小鲨鱼2018 阅读(1236) 评论(0) 推荐(0) 编辑
上一页 1 ··· 274 275 276 277 278 279 280 281 282 ··· 367 下一页