?? teacher.cpp
字號:
#include<iostream.h>
#include<string.h>
#include"Teacher.h"
Teacher::Teacher(char*na,int a,char*s,char*ad,char*tel,char*t)
{
name=new char[strlen(na)+1]; //開辟空間
strcpy(name,na);
age=a;
sex=new char[strlen(s)+1];
strcpy(sex,s);
address=new char[strlen(ad)+1];
strcpy(address,ad);
telephone=new char[strlen(tel)+1];
strcpy(telephone,tel);
title=new char[strlen(t)+1];
strcpy(title,t);
}
void Teacher::display() //調用成員函數輸出對象
{
cout<<"姓名是: "<<name<<endl;
cout<<"年齡是: "<<age<<endl;
cout<<"性別是: "<<sex<<endl;
cout<<"住址是: "<<address<<endl;
cout<<"電話是: "<<telephone<<endl;
cout<<"職稱是: "<<title<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -