student.cpp

来自「c++书籍的源代码」· C++ 代码 · 共 27 行

CPP
27
字号
//student.cpp
#include<iostream.h>
#include<string.h>
#include"student.h"
 student::student(char *s,int t)
{
  name=new char[strlen(s)+1];
  strcpy(name,s);
  score=t;
}
 student::student(student &p)
{
  name=new char[strlen(p.name)+1];
  score=p.score;
}
 student::~student()
{
  delete[]name;
}
 void student::display(void)
{
  cout<<"姓名:"<<name<<" 成绩:"<<score<<endl;
}
 int student::get_s(void)
{
  return(score); 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?