第十一周上机项目1 是春哥啊

来源:互联网 发布:高性能网络编程框架 c 编辑:程序博客网 时间:2024/05/17 23:57
项目0 - 是春哥啊】请在下面程序的横线处填上适当内容,以使程序完整,并使程序的输出为:Name: 春哥Grade: 19
<pre name="code" class="cpp">#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: ___________//(1)   {  public:      Student(char* s, int g):__________ // (2)       {grade=g;}      void display1( ) {          _________;   //  (3)           cout<<"Grade: "<<grade<<endl;      }  private:      int grade;  };  int main( )  {      Student s("春哥",19);      ___________;       //  (4)       return 0;  }  

解答结果
(1) public Person(2)Person(s)(3)display()(4)s.display1( )
<img src="http://img.blog.csdn.net/20150524204024998" alt="" />
0 0
原创粉丝点击