正在加载图片...
score[ 0]. totalscore+=result[j]. score; f(result [. gender=0)score[ 0]. malescore+=result[].score Ise score[ 0 ].femalescore-+=result [].score for(=0;<5;H printf("School %d: n",i); printf("Total score of male: %d\n" score[i]. malescore) printf("Total score of female: %d\ n", score[]. femalescore) printf("Total score of all: %d\nIn" score[i]. totalscore) 1.19 Status algo1 19(inta[ ARRSIZE)求*2个序列的值且不超过 maxint last=1 for(Fl; K<=ARRSIZE; 1++) a**1 if(a[i-1 ]last)!=(2*i)) reurn OVERFLOW last=a[]; return OK. i//algo1 19 分析:当某一项的结果超过了 maxint时,它除以前面一项的商会发生异常 120 void polyvalueo float temp float"p=a printf("Input number of terms: " printf("Input value of x: )3 scanf(%f", &x); printf("Input the %d coefficients from a0 to a%d: \n",n+l, n); p=axp=l,sum=0;/xp用于存放x的i次方 for(=0i<=n;i++)score[ 0 ].totalscore+=result[i].score; if(result[i].gender==0) score[ 0 ].malescore+=result[i].score; else score[ 0 ].femalescore+=result[i].score; break; …… …… …… } i++; } for(i=0;i<5;i++) { printf("School %d:\n",i); printf("Total score of male:%d\n",score[i].malescore); printf("Total score of female:%d\n",score[i].femalescore); printf("Total score of all:%d\n\n",score[i].totalscore); } }//summary 1.19 Status algo119(int a[ARRSIZE])//求 i!*2^i 序列的值且不超过 maxint { last=1; for(i=1;i<=ARRSIZE;i++) { a[i-1]=last*2*i; if((a[i-1]/last)!=(2*i)) reurn OVERFLOW; last=a[i-1]; return OK; } }//algo119 分析:当某一项的结果超过了 maxint 时,它除以前面一项的商会发生异常. 1.20 void polyvalue() { float temp; float *p=a; printf("Input number of terms:"); scanf("%d",&n); printf("Input value of x:"); scanf("%f",&x); printf("Input the %d coefficients from a0 to a%d:\n",n+1,n); p=a;xp=1;sum=0; //xp 用于存放 x 的 i 次方 for(i=0;i<=n;i++)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有