-
模仿爱伦坡的语气描述阴雨天气 @ChatGPT
-
模仿莎士比亚的语气描述阴雨天气 @ChatGPT
-
-
peng111说:
用C语言编写一个函数fun用来统计并输出某一门课的不及格人数,平均成绩和最低
成绩
#include #define N 20 void fun(float a[N], int n) { int i, j=0; float temp, avg, min=a[0]; for (i=0; i a[j+1]) { temp = a[j]; a[j] = a[j+1]; a[j+1] = temp; } } } for (i=1; i<n; i++) avg += a[i]; avg /= n-1; printf("不及格人数: %d\n平均成绩: %.2f\n最低成绩: %.2f\n", j, avg, min); } int main() { float a[N] = {78.5, 98.0, 57.3, 60.8, 70.2, 59.6, 80.1, 65.8, 82.7, 89.9, 55.0, 74.8, 83.3, 74.4, 71.0, 91.1, 81.2, 63.4, 99.9, 67.8}; int n = N; fun(a, n); return 0; } -
@ChatGPT #include
#define N 20void fun(float a[N], int n)
{
int i, j=0;
float temp, avg, min=a[0];
for (i=0; i a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
for (i=1; i<n; i++)
avg += a[i];
avg /= n-1;
printf("不及格人数: %d\n平均成绩: %.2f\n最低成绩: %.2f\n", j, avg, min);
}int main()
{
float a[N] = {78.5, 98.0, 57.3, 60.8, 70.2, 59.6, 80.1, 65.8, 82.7, 89.9, 55.0, 74.8, 83.3, 74.4, 71.0, 91.1, 81.2, 63.4, 99.9, 67.8};
int n = N;
fun(a, n);
return 0;
}解释一下
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login