14.4

//baddude.h
#ifndef _BADDUDE_H
#define _BADDUDE_H
#include<cstdlib>
#include<ctime>
#include<string>
using namespace std;
class Person
{
private:
	string fname;
	string sname;
	
	int number;
protected:
	virtual void Draw()const;
	virtual void Get();
public:
	virtual void Show()const=0;
	Person(): fname("none"),sname("none"),number(0){}
	Person(const string& fn,const string & sn,int n):fname(fn),sname(sn),number(n){}
	virtual~Person()=0;
	virtual void Set()=0;
	
};

class PokerPlayer:public virtual Person
{
private:
	int cnumber;
protected:
	void Draw() const;
	void Get() ;
public:
	PokerPlayer():Person(),cnumber(0){}
	PokerPlayer(const string& fn,const string & sn,int n,int cn):Person(fn,sn,n),cnumber(cn){};
	PokerPlayer(const Person &per,int cn):Person(per),cnumber(cn){}
	void Set();
	void Show()const;
};

class Gunslinger:public virtual Person
{
private:
	double time;
protected:
	void Draw()const;
	void Get();
public:
	Gunslinger():Person(),time(0){}
	Gunslinger(const string& fn,const string & sn,int n,double t):Person(fn,sn,n),time(t){}
	Gunslinger(const Person &per,double t):Person(per),time(t){}
	void Set();
	void Show()const;
};

class BadDude :public PokerPlayer,public Gunslinger
{
protected:
		void Draw()const;
		void Get();
public:
	BadDude(){};
	BadDude(const string& fn,const string & sn,int n,double t,int cn):Person(fn,sn,n),PokerPlayer(fn,sn,n,cn),Gunslinger(fn,sn,n,t){}
	BadDude(const Person &per,int cn,double t):Person(per),PokerPlayer(per,cn),Gunslinger(per,t){}
	BadDude(const PokerPlayer &po, double t):Person(po),PokerPlayer(po),Gunslinger(po,t){}
	BadDude(const Gunslinger &gu,int cn):Person(gu),PokerPlayer(gu,cn),Gunslinger(gu){}
	void Set();
	void Show()const;
};
#endif
//baddude.cpp
#include"baddude.h"
#include<iostream>
using namespace std;
Person::~Person(){}
void Person::Draw()const
{
	cout<<"first name: "<<fname<<endl;
	cout<<"second name: "<<sname<<endl;
	cout<<"number: "<<number<<endl;
}
void Person::Get()
{
	cout<<"enter first name: ";
	getline(cin,fname);
	cout<<"enter second name: ";
	getline(cin,sname);
	cout<<"number: ";
	cin>>number;
}

void PokerPlayer::Draw()const
{
	cout<<"card number: "<<cnumber<<endl;
}
void PokerPlayer::Get()
{

	cout<<"enter card number: ";
		std::srand(std::time(0));
		cnumber=std::rand()%52+1;
}
void PokerPlayer ::Set()
{
	Person::Get();
	Get();
}
void PokerPlayer::Show()const
{
	Person::Draw();
	Draw();
}


void Gunslinger::Draw()const
{
	cout<<"time: "<<time<<endl;
}
void Gunslinger::Get()
{
	cout<<"enter time : ";
	cin>>time;
}
void Gunslinger::Set()
{
	Person::Get();
	Get();
}
void Gunslinger::Show()const
{
	Person::Draw();
	Draw();
}
void BadDude ::Draw()const
{
	Person::Draw();
	PokerPlayer::Draw();
	Gunslinger::Draw();
}

void BadDude::Get()
{
	Person::Get();
	PokerPlayer::Get();
	Gunslinger::Get();
}
void BadDude::Set()
{
	Get();
}
void BadDude::Show()const
{
	Draw();
}
//maim.cpp
#include"baddude.h"
#include<cstdlib>
#include<ctime>
#include<string>
#include<iostream>
using namespace std;

const int SIZE =2;

int main()
{

	Person * per[SIZE];
	int ct;
	for(ct =0;ct<SIZE;ct++)
	{
		char choice;
		cout<<"enter the  person category: \n"
		<<"a: person  b: pokerplayer "<<" c: gunslinger   d: baddude";
		cin>>choice;
		while(strchr("bcdq",choice)==NULL)
		{
			cout<<"please enter b,c,d or q:";
			cin>>choice;
		}
		if(choice =='q')
			break;
		switch(choice)
		{
		case 'b':per[ct]=new PokerPlayer;
			 break;
		case'c':per[ct]=new Gunslinger;
			break;
		case'd': per[ct]=new BadDude;
			break;
		}
		cin.get();
    	per[ct]->Set();
	}
	cout<<endl;
	for(int i=0;i<ct;i++)
	{
		cout<<endl;
		per[i]->Show();
	}
	for(int i=0;i<ct;i++)
	 delete per[i];
	cout<<endl;
	system("pause");
	return 0;
}

基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip基于bert实现关系三元组抽取python源码+数据集+项目说明.zip 个人大四的毕业设计、课程设计、作业、经导师指导并认可通过的高分设计项目,评审平均分达96.5分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 [资源说明] 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设或者课设、作业,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96.5分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),供学习参考。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值