【正文】
l be 167(cm)include main() { float fh, mh, h。 printf(Are you a boy(M) or a girl(F)?)。 getchar()。s height(cm):)。fh)。 printf(Please input your mother39。 scanf(%f, amp。 getchar()。 sports = getchar()。 printf(Do you have a good habit of diet(Y/N)?)。 if (sex == 39。) h = (fh + mh) * 。F39。 else{ printf(Error!\n)。 } if (sports == 39。) h = h * 。N39。 else{ printf(Error!\n)。 } if (diet == 39。) h = h * 。N39。 else{ printf(Error!\n)。 } printf(Your future height will be %.0f(cm)\n, h)。 }窗體底端窗體頂端窗體頂端Q3134.(窗體底端.(10分)第8章實驗1:某班有最多不超過30人(具體人數(shù)由鍵盤輸入)參加某門課程的考試,用一維數(shù)組作函數(shù)參數(shù)編程實現(xiàn)如下學生成績管理:(1)錄入每個學生的學號和考試成績;(2)計算課程的總分和平均分;(3)按成績由高到低排出名次表;(4)按學號由小到大排出成績表;(5)按學號查詢學生排名及其考試成績;(6)按優(yōu)秀(90~100)、良好(80~89)、中等(70~79)、及格(60~69)、不及格(0~59)5個類別,統(tǒng)計每個類別的人數(shù)以及所占的百分比;(7)輸出每個學生的學號、考試成績。 scores record total and average score of course in descending order by score in ascending order by number by number analysis recordPlease Input your choice:1↙Input student39。 scores record total and average score of course in descending order by score in ascending order by number by number analysis recordPlease Input your choice:2↙sum=473,aver=Management for Students39。 scores record total and average score of course in descending order by score in ascending order by number by number analysis recordPlease Input your choice:4↙Sort in ascending order by number:11003001 8711003002 4811003003 7511003004 6511003005 9811003006 100Management for Students39。 scores record total and average score of course in descending order by score in ascending order by number by number analysis recordPlease Input your choice:6↙60 1 %6069 1 %7079 1 %8089 1 %9099 1 %100 1 %Management for Students39。 scores record total and average score of course in descending order by score in ascending order by number by number analysis recordPlease Input your choice:8↙Input error!Management for Students39。s ID, name and score:\n輸出格式:菜單項的輸出顯示:Management for Students39。 long ids。 printf(Input student number(n30):\n)。n)) { if(n30amp。n0) break。 continue。 float score[N]。 scores\n)。 printf( total and average score of course\n)。 printf( in ascending order by number\n)。 printf( analysis\n)。 printf(\n)。 scanf(%d,amp。 getchar()。 1:goto a。 2:goto b。 3:goto c。 4:goto d。 5:goto e。 6:goto f。 7:goto g。 0:goto end。 goto Choice。s ID, name and score:\n)。i=n。id[i],amp。 getchar()。 b: sum=0。i=n。 printf(sum=%.0f,aver=%.2f\n,sum,sum/n)。 c: printf(Sort in descending order by score:\n)。in。j=n。 score[i]=score[j],id[i]=id[j]。 } for(i=1。i++) printf(%ld\t%.0f\n,id[i],score[i])。 d: printf(Sort in ascending order by number:\n)。in。j=n。 score[i]=score[j],id[i]=id[j]。 } for(i=1。i++) printf(%ld\t%.0f\n,id[i],score[i])。 e: printf(Input the number you want to search:\n)。ids)。 for(i=1。i++) { if(ids==id[i]) { printf(%ld\t%.0f\n,id[i],score[i])。 } elsecontinue。 goto Choice。i=10。 for(j=1。j++) { mark=score[j]60?5:(int)score[j]/10。 } if(i==5) { printf(60\t%d\t%.2f%%\n,p,(float)p/n*100)。 } else if(i=6amp。i=9) { printf(%d%d\t%d\t%.2f%%\n,i*10,i*10+9,p,(float)p/n*100)。 } elseprintf(%d\t%d\t%.2f%%\n,i*10,p,(float)p/n*100)。 g: for(i=1。i++) printf(%ld\t%.0f\n,id[i],score[i])。 end: printf(End of program!\n)。 }窗體底端窗體頂端Q3262.(10分)題目:一個整數(shù),它加上100后是一個完全平方數(shù),再加上168又是一個完全平方數(shù),請按從小到大的順序,連續(xù)輸出3個滿足這樣條件的數(shù)?程序分析:使用窮舉法,如果找到三個這樣的數(shù)據(jù),就停止。要求輸入,每行一個滿足條件的數(shù),例如:結(jié)果1結(jié)果2結(jié)果3include include int fun(int n)。 p = 0。 p 3。amp。 p++。 result = 0。 if (s * s == n) result = 1。 }窗體底端窗體頂端Q3263.(10分)輸出 1100之間所有素數(shù),并求和。每個素數(shù)的輸出格式:%d\n求和輸出格式:“sum of prime numbers:%d\n”include int Fun(int m)。 for (i = 1, p = 0。 i++) if (Fun(i) == 1) { printf(%d\n, i)。 } printf(sum of prime number:%d\n, p)。 } int Fun(int m) { int i, result。 if (m == 2)。 i m。 break。 }窗體底端