第十一周 项目一是春哥呀
2015-05-24 16:46
120 查看
/*
*Copyright (c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:d.cpp
*作 者:张旺华
*完成日期:2015年5月24日
*版 本 号:v1.0
*/
【项目0 - 是春哥啊】
请在下面程序的横线处填上适当内容,以使程序完整,并使程序的输出为:
Name: 春哥
Grade: 19
[cpp] view plaincopyprint?在CODE上查看代码片派生到我的代码片
#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 person
{
public:
Student(char* s, int g):__________ // (2) person(s)
{grade=g;}
void display1( ) {
_________; // (3) display()
cout<<"Grade: "<<grade<<endl;
}
private:
int grade;
};
int main( )
{
Student s("春哥",19);
___________; // (4) s.diaplay1()
return 0;
}
*Copyright (c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:d.cpp
*作 者:张旺华
*完成日期:2015年5月24日
*版 本 号:v1.0
*/
【项目0 - 是春哥啊】
请在下面程序的横线处填上适当内容,以使程序完整,并使程序的输出为:
Name: 春哥
Grade: 19
[cpp] view plaincopyprint?在CODE上查看代码片派生到我的代码片
#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 person
{
public:
Student(char* s, int g):__________ // (2) person(s)
{grade=g;}
void display1( ) {
_________; // (3) display()
cout<<"Grade: "<<grade<<endl;
}
private:
int grade;
};
int main( )
{
Student s("春哥",19);
___________; // (4) s.diaplay1()
return 0;
}