zoukankan      html  css  js  c++  java
  • 第十一周项目0-是春哥啊

    请在下面程序的横线处填上适当内容,以使程序完整,并使程序的输出为:
    Name: 春哥

    Grade: 19

    /*
     *Copyright (c) 2015,烟台大学计算机学院
     *All gight reserved.
     *文件名称:Demo.cpp
     *作者:邵帅
     *完成时间:2015年05月25日
     *版本号:v1.0
    */
    #include <iostream>
    #include <cstring>
    using namespace std;
    class Person{
    public:
        Person(char* s){
            strcpy(name,s);
        }
        void display( ){
            cout<<"Name: "<<name<<endl;
        }
    private:
        char name [20];
    };
    class Student: public Person
    {
    public:
        Student(char* s, int g):Person(s)
        {grade=g;}
        void display1( ) {
            display();
            cout<<"Grade: "<<grade<<endl;
        }
    private:
        int grade;
    };
    int main( )
    {
        Student s("春哥",19);
        s.display1();
        return 0;
    }
    
    运行结果:


    @ Mayuko

  • 相关阅读:
    [POI2010]Divine Divisor
    JOISC2014B たのしい家庭菜園
    Problem. C
    AGC004F Namori
    AGC007F Shik and Copying String
    AGC027C ABland Yard
    AGC028E High Elements
    JOI2017FinalE 縄
    CF797F Mice and Holes
    Problem. B
  • 原文地址:https://www.cnblogs.com/mayuko/p/4567490.html
Copyright © 2011-2022 走看看