结构体——使用结构体实现求平均成绩

来源:互联网 发布:国家电网大数据 编辑:程序博客网 时间:2024/06/04 20:01

使用结构体实现求平均成绩

/*********************************功能:使用结构体实现求平均成绩日期:2014年12月10日10:47:03************************************/#include<stdio.h>int main(){struct student_score{int mid;int end;int ave;}score;printf("Please input score (midterm and end of term):");scanf("%d,%d",&score.mid, &score.end);score.ave = (score.mid + score.end) / 2;printf("average = %d\n", score.ave);}/**************************************************Please input score (midterm and end of term):25,69average = 47Press any key to continue****************************************************/


0 0