大学c语言有没有期末考试

Python016

大学c语言有没有期末考试,第1张

大学c语言有期末考试。根据查询相关信息显示:C语言是一种计算机程序设计语言,具有高级语言的特点,汇编语言的特点,可以作为工作系统设计语言,编写系统应用程序,也可以作为应用程序设计语言,编写不依赖计算机硬件的应用程序,故大学c语言有期末考试。

#include <stdio.h>

#include <stdlib.h>

/* 1。根据学生信息定义一个结构体类型,再说明一个该结构体类型的数组。*/

struct stu_info{

char stuNo[10]/* No */

char stuName[30]/* Name */

float stuScore[3]/* the three scores */

float aveScore/* average score */

float totalScore/* total score */

}stu[10]

/* 2。用input函数从键盘上输入10个学生的数据。 */

void input()

{ int i = 0

printf("Input the students' infomation(FORMAT LIKE:No Name score1 score2 score3):\n")

while(i <10)

{printf("Input %d:",i + 1)

scanf("%s%s%f%f%f",stu[i].stuNo,stu[i].stuName,&stu[i].stuScore[0],&stu[i].stuScore[1],&stu[i].stuScore[2])

i++

}

}

/* 3。用average函数求出每个学生总成绩、平均成绩和所有学生的总平均成绩。 */

float average()

{ int i = 0

float totalAve_score = 0

while(i <10)

{ stu[i].totalScore = stu[i].stuScore[0]+stu[i].stuScore[1]+stu[i].stuScore[2]

stu[i].aveScore = stu[i].totalScore/3

totalAve_score += stu[i].aveScore

i++}

totalAve_score /= 10

return totalAve_score}

/* 4。用maximum函数找出最高分的学生的数据。 */

int maximun()

{int i = 0, k=0

float tmp=stu[0].totalScore

while(++i <10)

{ if(tmp <stu[i].totalScore)

{tmp = stu[i].totalScore

k = i

}

}

return k

}

/* 5。在主函数中输出每位学生的学号、姓名、三门课成绩、总成绩和平均成绩以及总平均分和最高分学生的数据。*/

int main(int argc, char *argv[])

{ int i = 0, highestNo

float totalAve_score

input() totalAve_score = average()

highestNo = maximun()

printf("NO.\t Name\tScore1\tScore2\tScore3\tTotal\taverage\n")

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

printf("%s %s\t %.1f\t%.1f\t%.1f\t%.2f\t%.2f\n",stu[i].stuNo,stu[i].stuName,stu[i].stuScore[0],stu[i].stuScore[1],stu[i].stuScore[2],stu[i].totalScore,stu[i].aveScore)

printf("average = %.2f\n",totalAve_score)

printf("The highest score:%s,score total:%.2f",stu[highestNo].stuName,stu[highestNo].totalScore)

system("PAUSE")

return 0

}