1樓:聽不清啊
#include
#include
#include
struct stu
,b;srand(time(null));
for(i=0;i<20;i++)
printf(" 學號 學科1 學科2 學科3 學科4 學科5 平均分\n");
for(i=0;i<20;i++)
printf("%7d%6d%6d%6d%6d%6d%7.1f\n",a[i].id,a[i].
cj[0],a[i].cj[1],a[i].cj[2],a[i].
cj[3],a[i].cj[4],a[i].zf/5.
0);i=20;
printf("%7s%6.1f%6.1f%6.
1f%6.1f%6.1f%7.
1f\n","平均分",a[i].cj[0]/20.0,a[i].
cj[1]/20.0,a[i].cj[2]/20.
0,a[i].cj[3]/20.0,a[i].
cj[4]/20.0,a[i].zf/100.
0);printf("不及格學生學號:");
for(i=0;i<20;i++)
{k=0;
for(j=0;j<5;j++)
if(a[i].cj[j]<60)k=1;
if(k)printf("%3d",a[i].id);
printf("\n");
return 0;
2樓:回憶在上輩子
五門課成績是分開存放還是存放五門課的總分?
如果是分開存放的話可以定義乙個包含20個元素的結構體陣列結構體中儲存五門課程成績
如果是儲存總分的話一般陣列即可完成
如果**不想自己寫的話
我可以有償代勞
c語言 輸入10個學生5門課的成績,分別使用函式實現下列功能 1.計算每個學生平均分 2.計算每門 10
3樓:q是
得使用結構體吧?我幫你解決
有m個學生,學習n門課程,已知所有學生的各科成績,分別求每個學生的平均成績和每門課程的平均成績?
c語言 輸入學生5門課的成績,分別寫函式完成
僑光宇向晨 include void pjun int a 5 void pjun2 int a 5 void search int a 5 printf 3d 3d x 1,y 1 void main int i,j for i 0 i 10 i for i 0 i 10 i printf n p...
c語言陣列題有學生上4門課要求輸入全部學
include c語言陣列題 有3個學生,上4門課,要求輸入全部學生各門課的成績並分別求出每門課的平均成績 int main int i,j double sum 0 for i 0 i 3 i for j 0 j 4 j for j 0 j 4 j printf 科目 d的平均分為 lf n j ...
C語言計算每門課的平均成績和每個學生的平均成績
include include define n 2 輸入學生的個數struct student void main struct student stu n int index int sum 0 輸入學生資訊 printf 輸入學生情況 輸入的時候按tab健隔開 n printf 學號 t姓名 ...
C語言有班學生,5門課程分別用函式求
include include stdlib.h 用於system pause.語句 include math.h 用於函式7 include string.h include iostream.h fflush stdin int q 0,p 0 struct stu float f031 str...
c語言中有班學生,5門課程,求(1)第一門課程的平均
include include stdlib.h 用於system pause.語句 include math.h 用於函式7 include string.h include iostream.h fflush stdin int q 0,p 0 struct stu float f031 str...