zoukankan      html  css  js  c++  java
  • 问题 B: 投简历

    题目描述

    小华历经12寒窗苦读,又经历4年大学磨砺,终于毕业了,随着毕业季的到来,找工作也日益紧张起来。由于要面试不同的公司,因此小华需要准备不同的简历。当然最基本的信息是必不可少的,基本信息:姓名、年龄、性别、专业。现有两家公司,小华想要投简历试一试。第一家langchao公司需要了解小华毕业学校,第二家lenovo公司需要了解小华的薪金目标(pay)。
    请你用类中继承的方法帮助他完成简历吧*-*  *-*  *-*

    输入

    输入两行,第一行:小华的信息。第二行:小华想要进入的公司名称。

    输出

    小华要递交的简历内容

    样例输入

    xiaohua 25 F IT YT 8000
    langchao

    样例输出

    name:xiaohua
    age:25
    sex:F
    major:IT
    school:YT

    提示

    前置代码及类型定义已给定如下,提交时不需要包含,会自动添加到程序前部


    #include <iostream>

    #include <string>

    using namespace std;

    class jianli

    {

    public:

        void getvalue(){

            cin>>name>>age>>sex>>major;

        }

        void display();

    private:

        string name;

        int age;

        char sex;

        string major;

    };


    主函数已给定如下,提交时不需要包含,会自动添加到程序尾部







    /* C++代码 */


    int main()

    {

        jianli1 xiaohua;

        jianli2 xiaohua2;

        string a="langchao",b="lenovo";

        string c;

        xiaohua.getvalue();

        xiaohua.getvalue1();

        xiaohua2.getvalue2();

        cin>>c;

        if(c==a){

            xiaohua.display();

            xiaohua.display1();

        }

        if(c==b){

            xiaohua.display();

            xiaohua2.display2();

        }

        return 0;

    }

    #include <iostream>
    #include <string>
    using namespace std;
    class jianli
    {
    	public:
    	void getvalue(){
    	     cin>>name>>age>>sex>>major;
    	}
    	void display();
    
    private:
    
    	string name;
    	int age;
    	char sex;
    	string major;
    };
    
    void jianli::display()
    {
    	cout << "name:" << name << endl;
    	cout << "age:" << age << endl;
    	cout << "sex:" << sex << endl;
    	cout << "major:" << major << endl;
    }
    
    class jianli1:public jianli
    {
    	public:
    		void getvalue1() {
    			cin >> school;
    		}
    	void display1();
    	
    	private :
    		string school;
    };
    
    void jianli1::display1()
    {
    	cout << "school:" << school << endl;
    }
    
    class jianli2:public jianli
    {
    	public:
    		void getvalue2() {
    			cin >> pay;
    		}
    	void display2();
    	
    	private :
    		int pay;
    };
    
    void jianli2::display2()
    {
    	cout << "pay:" << pay << endl;
    }
    
    
    int main()
    
     {
    
         jianli1 xiaohua;
    
         jianli2 xiaohua2;
    
         string a="langchao",b="lenovo";
    
         string c;
    
         xiaohua.getvalue();
    
         xiaohua.getvalue1();
    
         xiaohua2.getvalue2();
    
         cin>>c;
    
         if(c==a){
    
             xiaohua.display();
    
             xiaohua.display1();
    
         }
    
         if(c==b){
    
             xiaohua.display();
    
             xiaohua2.display2();
    
         }
    
         return 0;
    
     }
    

      

  • 相关阅读:
    c++11 static_assert
    UVA
    析构函数与运行错误
    UVA
    2017 ACM-ICPC 亚洲区(乌鲁木齐赛区) C. Coconut
    2017 ACM-ICPC 亚洲区(乌鲁木齐赛区) A. Banana
    DOCTYPE的作用?
    数组去重的方法
    闭包的分析?
    SVN(集中式管理)分析
  • 原文地址:https://www.cnblogs.com/mjn1/p/10682787.html
Copyright © 2011-2022 走看看