轻松的编程学习
首页
题库
学习路径
在线商城
能力地图
下载应用
登录 / 注册
菜单
交付:四条验收条款一起过
👁️ 0 人浏览
💬 0 人评论
❤️ 添加收藏
(本条路线统一用
gcc -std=c11 -O0
编译)把四条验收各写成一个判断,一起输出(1 表示过)。
提交你的答案
请登录后提交答案。
去登录
← 🔴 拿全负数的数组验一次
函数里声明的普通变量,函数返回之后还在吗 →
更多题目
改成"你好,有词"
输出"100 分"
把年龄改成 20
输出学习天数 30
修复:给文字加引号
修复:补上右括号
代码编辑器
语言:
python3
c11
cpp17
Ctrl
+
Enter
运行
👩🏫 AI
▶ 运行代码
重置代码
打印代码
#include <stdio.h> #define N 5 int sum_of(const int *a, int n); int max_of(const int *a, int n); int main(void) { int a[N] = {10, 20, 30, 40, 50}; int neg[3] = {-7, -3, -9}; /* 四条验收条款 */ int c1 = (N == sizeof(a) / sizeof(a[0])); /* 宏和实际长度对得上 */ int c2 = (sum_of(a, N) == 150); /* 求和对 */ /* TODO: c3 —— max_of 在正数组上给 50 */ int c3 = 0; /* TODO: c4 —— max_of 在全负数组上给 -3(初值没写死成 0) */ int c4 = 0; printf("%d/%d/%d/%d\n", c1, c2, c3, c4); return 0; } int sum_of(const int *a, int n) { int s = 0; for (int i = 0; i < n; i++) s += a[i]; return s; } int max_of(const int *a, int n) { int m = a[0]; for (int i = 1; i < n; i++) if (a[i] > m) m = a[i]; return m; }
本次输入:
输出:
👩🏫
AI
请登录后使用 AI 老师
×
登录后可获得解题思路、提示与错误分析。
去登录
关闭
🎉
恭喜你,回答正确!
系统判定:正确
我知道了
💬 题目评论
提交
全部评论
全部评论