|
发表于 2022-10-9 10:09:59
|
显示全部楼层
本楼为最佳答案
- #include <stdio.h>
- #define max 100
- int main(void) {
- int x, arrA[max], arrB[max], n, m = n = 0;
- char c;
- scanf("%d", &x); // 第一行赋值到一个变量里
- // 第二行都有多个数字,赋值到数组 arrA 中。
- do {
- scanf("%d%c", &arrA[n++], &c);
- } while (c != '\n');
- // 第三行都有多个数字,赋值到数组 arrB 中。
- do {
- scanf("%d%c", &arrB[m++], &c);
- } while (c != '\n');
- // ---------------------------------------------
- // 开始打印
- printf("x = %d\narr A = ", x);
- for (int i = 0; i < n; ++i) {
- printf("%d ", arrA[i]);
- }
- printf("\narr B = ");
- for (int i = 0; i < m; ++i) {
- printf("%d ", arrB[i]);
- }
- printf("\n");
- return 0;
- }
复制代码- 13
- 45 78 91 72 58 4 1
- 16 5 42 86 72 19
- x = 13
- arr A = 45 78 91 72 58 4 1
- arr B = 16 5 42 86 72 19
复制代码 |
评分
-
查看全部评分
|