當前位置:編程學習大全網 - 編程軟體 - C語言程序設計實驗報告

C語言程序設計實驗報告

代碼:

# include <stdio.h>

# include<stdlib.h>

char stu_no[10][10];

int c_math[10],c_en[10],c_computer[10],point[10],average[10];

int i,j,max;

char c;

void input()

{

for(i=0;i<=9;i++) /*輸入學生成績*/

{

printf("請輸入學號:");

scanf("%s",&stu_no[i]);

printf("\n請輸入數學成績:");

scanf("%d",&c_math[i]);

printf("\n請輸入英語成績:");

scanf("%d",&c_en[i]);

printf("\n請輸入計算機基礎成績:");

scanf("%d",&c_computer[i]);

}

for(i=0;i<=10;i++) /*計算總分跟平均分*/

{

point[i]=c_math[i]+c_en[i]+c_computer[i];

average[i]=point[i]/3;

}

}

void paixu()

{

printf("成績按從高到低排列為:\n");

printf("\n學號 數學 英語 計算機基礎 總分 平均分\n");

for (i=0;i<=10;i++)

{ for(j=1;j<=10;j++)

if (point[i]>point[j])

max=i;

printf("%s,d,%d,%d,%d,%d,%d\n",stu_no[max],c_math[max],c_en[max],c_computer[max],point[max],average[max]);

}

}

void main()

{

input();

paixu();

}

  • 上一篇:用C語言編程驗證 任壹大於2的偶數都可以寫成兩個質數之和
  • 下一篇:win10系統怎樣安裝驅動程序
  • copyright 2024編程學習大全網