?? person.cpp
字號:
//person.cpp
#include<iostream.h>
#include<string.h>
#include<assert.h>
#include<iomanip.h>
#include"person.h"
person::person(long k,char*str)
{
number=k;
name=new char[strlen(str)+1];
assert(name!=0);
strcpy(name,str);
}
person::~person()
{
delete[]name;
}
void person::reset_number()
{
long n;
cout<<"請重新輸入編號:"<<endl;
cin>>n;
number=n;
cout<<"修改已成功!"<<endl;
}
void person::reset_name()
{
char*b=new char;
cout<<"請重新輸入姓名:"<<endl;
cin>>b;
name=b;
cout<<"修改已成功!"<<endl;
}
void person::set_password()
{
int m,n;
cout<<"請重新設(shè)置你的密碼:"<<endl;
cin>>m;
cout<<"請?jiān)佥斎胍槐?"<<endl;
cin>>n;
if(m==n)
{
password=m;
}
else
{
cout<<"輸入錯(cuò)誤!"<<endl;
set_password();
}
}
long person::get_number()
{
return number;
}
char*person::get_name()
{
return name;
}
int person::get_password()
{
return password;
}
void person::print()
{
cout<<"編號:"<<number<<setw(16)<<"姓名:"<<name<<endl;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -