- 博客(5)
- 收藏
- 关注
原创 C语言字符串增删符号问题
现在有一串字符需要输入,规定输入的字符串中只包含字母和号。请编写程序,实现以下功能:除了字符串前后的号之外,将串中其他的*号全部删除。 例如,假设输入的字符串为ABCDEFG********,删除串中的号后,字符串变为*ABDEFG******** #include<stdio.h> #include<stdlib.h> #include<string.h> v...
2020-04-27 17:56:58
476
原创 0 ‘\0’ ‘0 ’sizeof() strlen()
例1:(2010-09-23)有以下程序 #include <stdio.h> #include <string.h> main() {char x[]=”STRING”; x[0]=0;x[1]=’\0’;x[2]=’0’; printf(“%d %d\n”,sizeof(x),strlen(x)); }程序运行后的输出结果是(B) A)6 1 B)7 0 ...
2020-04-21 17:11:39
305
原创 a,b,c按从小到大顺序输出
#include<stdio.h> int main() { int a, b, c, t; printf("请输入三个数:"); scanf_s("%d%d%d", &a, &b, &c); if (a > b) { t = a; a = b; b = t; } if (b > c) { t = b; b = c...
2020-02-01 15:59:57
3903
原创 C程序设例题7.9输入后一直输出第一个数因为输入格式不对
#include <stdio.h> int main() { int max(int x, int y); int i, a[10], m, n; printf(“enter 10 integer numbers:”); for (i = 0; i < 10; i++) scanf_s("%d", &a[i]); printf("\n"); for (i = 1, m ...
2020-01-30 14:29:43
371
原创 C程序设计书本例题 求两整数之间最大值
#include<stdio.h> #include<stdlib.h> int main() { int max(int x, int y); int a, b, c; scanf_s("%d,%d",&a,&b); c = max(a, b); printf(“max=%d\n”, c); system(“pause”); return 0; } i...
2020-01-21 12:10:47
1092
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人