2674-学生成绩统计
来源:互联网 发布:程序员为什么工资高 编辑:程序博客网 时间:2024/04/29 16:39
#include <bits/stdc++.h>using namespace std;class Student{private: int id, math, english, computer; char name[20];public: int sum() { return math + english + computer; } double average() { return sum()/3.0; } void print() { printf("%d\t%s\t%d\t%d\t%d\t%d\t%.1f\n",id, name, math, english, computer, sum(), average()); } void set_stu_info(int n, char *p, int m, int e, int c) { id = n; strcpy(name,p); math = m; english = e; computer = c; }};int main(){ Student s[5]; for(int i = 0; i <= 4; i++) { int n, m, e, c; char p[20]; cin >> n >> p >> m >> e >> c; s[i].set_stu_info(n, p, m, e, c); } printf("Input the messages of five students(StudentID Name Math English Computer )\n\n"); printf("StuID\tName\tMath\tEng\tCom\tTotal\tAverage\n"); for(int i = 0; i <= 4; i++) { s[i].print(); } return 0;}
阅读全文
0 0
- 2674-学生成绩统计
- 【2674】3-5 学生成绩统计 SDUT
- 2674 3-5 学生成绩统计
- SDUT-2674 3-5 学生成绩统计
- 2674 3-5 学生成绩统计
- 学生成绩统计器
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 学生成绩统计
- 数据库统计学生成绩
- 学生成绩统计
- 学生成绩统计
- TP5 Validate验证规则
- 2673-计算长方形的周长和面积
- php 获取手机信息
- 智力4
- 线性表
- 2674-学生成绩统计
- 史上最全的iOS之UITextView实现placeHolder占位文字的N种方法
- 【XML】C#中XML文件增删改查简单应用
- 2675-静态数据成员与静态成员函数
- 1. 机器学习基石-When can Machine Learn?
- [Golang学习]Ubuntu搭建Go语言开发环境
- windows 10 下安装weex-toolkit
- C++ Primer 中文版(第5版) 习题答案
- 《Win32多线程程序设计》CRT中的多线程