Problem A: 大学的组织架构
来源:互联网 发布:迅雷cdn 知乎 编辑:程序博客网 时间:2024/05/17 20:30
Problem A: 大学的组织架构
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 499 Solved: 411
[Submit][Status][Web Board]
Description
一个大学是由若干个学院、系组成的,每个学院、系有自己的名称和领导。定义Orgnization类,具有2个string属性,分别是一个组织的名称和其领导的名字;具有一个show方法,用于显示该组织的信息。
该类有2个子类:College、Department。其中College的show方法显示格式为:
Dean of $ is &
Department的show方法显示格式为:
Director of $ is &
上述格式中,$表示College或Department的名字,&是相应的领导的名字。
Input
输入多行。
第1行N表示一个大学的下属机构的个数。
之后有N组输入。每组输入有3行,第1行是0或1,0表示这是一个College,1表示这是一个Department。
第2行是College或Department的名字。
第3行是相应的领导名字。
Output
见样例。
Sample Input
40College of InformationTom Zhang1Department of SoftwareJack Li0College of MathMary Wang1Department of ComputerFu Qi
Sample Output
Dean of College of Information is Tom ZhangDirector of Department of Software is Jack LiDean of College of Math is Mary WangDirector of Department of Computer is Fu Qi
HINT
Append Code
append.cc,
#include <bits/stdc++.h>using namespace std;class Orgnization{public: string orname; string topname; Orgnization(string orname,string topname):orname(orname),topname(topname){} virtual void show()=0;};class College:public Orgnization{public: College(string _orname,string _topname):Orgnization(_orname,_topname){} void show(){cout<<"Dean of "<<orname<<" is "<<topname<<endl;}};class Department:public Orgnization{public: Department(string _orname,string _topname):Orgnization(_orname,_topname){} void show(){cout<<"Director of "<<orname<<" is "<<topname<<endl;}};int main(){ vector<Orgnization*> university; vector<Orgnization*>::iterator itr; int n, i, t; string str1, str2; cin>>n; for (i = 0; i < n; i++) { cin>>t; cin.ignore(); getline(cin, str1); getline(cin, str2); if (t == 0) university.push_back(new College(str1, str2)); else university.push_back(new Department(str1, str2)); } for (itr = university.begin(); itr != university.end(); itr++) (*itr)->show(); return 0;}
0 0
- Problem A: 大学的组织架构
- Problem B: 大学的组织架构
- IDH的组织架构
- SAP的组织架构
- 测试部门的组织架构
- ARMv5 架构寄存器的组织
- C2C平台的组织架构
- Oracle EBS的组织架构
- Oracle EBS的组织架构
- Oracle EBS的组织架构
- 中南大学2016年校队选拔赛第一场Problem A
- 中南大学2016年校队选拔赛第二场Problem A
- 大型复杂信息系统研发的大学式组织管理方法
- 大学如何组织大型信息系统研发的外协?
- 精心打造Team的组织架构
- B2C电子商务网站的组织架构
- B2C电子商务网站的组织架构
- it巨头的组织架构图
- 《C语言及程序设计》教学视频 <18 链表中结点的插入和删除> 示例代码
- jquery自己写插件
- unity3d c#用于两个坦克对打血条的增减
- 浅谈java集合
- 玩转java多线程学习篇二 实例变量与线程安全
- Problem A: 大学的组织架构
- 决策树模型组合之随机森林与GBDT
- Zuma Game
- mybatis插入时返回自增主键
- JDBC操作步骤及数据库连接操作
- 欢迎使用CSDN-markdown编辑器
- OpenStack 和 Ceph 集成
- sdut 2161 Simple Game(山东省第二届acm省赛A题)(博弈论Nim+Bush?)
- H265(HEVC) nal 单元头介绍及rtp发送中的fu分组发送详解