简单的学生信息处理程序实现
2015-09-30 12:47
323 查看
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <stdio.h> using namespace std; class student { private : string name; unsigned int age; string ID; unsigned int score_first; unsigned int score_second; unsigned int score_third; unsigned int score_fourth; unsigned int score_average; public: student(string _name, unsigned int _age, string _ID, unsigned int _score_first, unsigned int _score_second, unsigned int _score_third, unsigned int _score_fourth) { name = _name; age = _age; ID = _ID; score_first = _score_first; score_second = _score_second; score_third = _score_third; score_fourth = _score_fourth; score_average = (score_first + score_second + score_third + score_fourth) / 4; } unsigned int get_score_average(){ return score_average; } unsigned int get_age(){ return age; } string get_name(){ return name; } string get_ID(){ return ID; } }; int main() { string name; unsigned int age; string ID; unsigned int score_first; unsigned int score_second; unsigned int score_third; unsigned int score_fourth; char* c_name = new char[100]; char* c_ID = new char[100]; scanf("%[^,],%d,%[^,],%d,%d,%d,%d", c_name,&age,c_ID,&score_first, &score_second, &score_third, &score_fourth); name = c_name; ID = c_ID; student stu(name,age,ID,score_first,score_second,score_third,score_fourth); cout << stu.get_name() << "," << stu.get_age() << "," << stu.get_ID() << "," << stu.get_score_average(); delete c_name; delete c_ID; return 0; }
相关文章推荐
- 项目范围管理论文的提纲
- ocp-v13-073
- ocp-v13-072
- 程序员在互联网公司和行业软件公司工作,有什么区别?
- ocp-v13-071
- jQuery.qrcode.js客户端生成二维码,支持中文并且可以生成LOGO
- GestureRecognizer手势
- 测试网址
- DNS正反解析及主从同步的实现
- 无主之地1
- 已知两个链表 la和 lb,其元素值递增排序。编程将la和lb合并成一个递减有序(相同值元素只保留一个)的链表lc。(北方名校经典试题) 本题选做
- POJ 2376 Cleaning Shifts(区间覆盖问题)
- 《Autotools - GNU Autoconf, Automake与Libtool实践者指南》第三章<用Autoconf配置你的项目>
- jQuery源码学习 之 get与eq的区别
- 《Autotools - GNU Autoconf, Automake与Libtool实践者指南》第二章<理解GNU编码标准>
- 天猫北上会师苏宁合围京东3C,让京东进退两难
- UGUI实现血条跟随
- ruby 淘宝镜像
- init.rc语法介绍
- centos安装svn服务器