資源簡介
用C++編寫的強(qiáng)大賽馬游戲,完全用類進(jìn)行構(gòu)建,學(xué)習(xí)類之間的交流,學(xué)習(xí)開發(fā)游戲很有幫助。

代碼片段和文件信息
/*?
?*?File:???Equipage.cpp
?*?Author:?john
?*?
?*?Created?on?2010年5月10日?下午9:35
?*/
#include?“Equipage.h“
#include
#include
#include
using?namespace?std;
#include?
#include
int?Equipage::countEquipage?=?0;
Equipage::Equipage()?{
????countEquipage++;
}
Equipage::Equipage(string?riderName?long?riderLicense?string?club?string?country?string?horseName?long?horseLicense?int?horseAge)?{
????this->?riderName?=?riderName;
????this->riderLicense?=?riderLicense;
????this->club?=?club;
????this->country?=?country;
????this->horseName?=?horseName;
????this->horseLicense?=?horseLicense;
????this->horseAge?=?horseAge;
????countEquipage++;
???
}
Equipage::~Equipage()?{
????countEquipage--;
}
Equipage?Equipage::set_equipage()?{
????//cin.get();
????cout<<“riderName:“< ????this->set_riderName(this->getstring());
cout<<“riderLicense:“< ?????this->set_riderLicense(this->getlong());
?cout<<“horseName:“< ?????this->set_horseName(this->getstring());
?cout<<“horseLicense:“< ?????this->set_horseLicense(this->getlong());
?cout<<“horseAge:“< ?????this->set_horseAge(this->getint());
??????cout<<“club:“< ?????this->set_club(this->getstring());
??????cout<<“country:“< ?????this->set_country(this->getstring());
????
??????return?Equipage(riderName??riderLicense??club?country??horseName?horseLicense?horseAge);
??????this->timing.set_flag(0);
}
string?Equipage::get_riderName()?{
????return?riderName;
}
void?Equipage::set_riderName(string?riderName)?{
????this->riderName?=?riderName;
???
}
long?Equipage::get_riderLicense()?{
????return?riderLicense;
}
void?Equipage::set_riderLicense(long?riderLicense)?{
????this->riderLicense?=?riderLicense;
}
string?Equipage::get_country()?{
????return?country;
}
void?Equipage::set_country(string?country)?{
????this->country?=?country;
}
string?Equipage::get_club()?{
????return?club;
}
void?Equipage::set_club(string?club)?{
????this->club?=?club;
}
string?Equipage::get_horseName()?{
????return?horseName;
}
void?Equipage::set_horseName(string?horseName)?{
????this->horseName?=?horseName;
}
long?Equipage::get_horseLicense()?{
????return?horseLicense;
}
void?Equipage::set_horseLicense(long?horseLicense)?{
????this->horseLicense?=?horseLicense;
}
int?Equipage::get_horseAge()?{
????return?horseAge;
}
void?Equipage::set_horseAge(int?horseAge)?{
????this->horseAge?=?horseAge;
}
string?Equipage::getstring()?{
????string?temp_string;
????bool?isAlpha?;
????do?{
????????getline(cin?temp_string);
????????if(temp_string.size()?>?20){
????????????cout<<“Too?large!“< ????????????continue;
????????}
????????else?if(temp_string.empty()){
????????????continue;
????????}
????????isAlpha?=?1;
????????for?(int?i?=?0;?i??????????????if?(!isalpha(temp_string[i])&&!isspace(temp_string[i])&&static_cast(temp_string[i])!=46&&static_cast(temp_string[i])!=58)
????????????????isAlpha?=?0;
????????}
?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\
?????文件?????????144??2010-05-27?13:38??實(shí)驗(yàn)9李兵6091820503\.dep.inc
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\build\
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\build\Debug\
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\
?????文件??????170546??2010-05-27?12:27??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\Equipage.o
?????文件?????????100??2010-05-27?12:27??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\Equipage.o.d
?????文件??????230690??2010-05-27?12:53??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\main.o
?????文件?????????118??2010-05-27?12:53??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\main.o.d
?????文件??????344775??2010-05-27?12:27??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\Mainmenu.o
?????文件?????????131??2010-05-27?12:27??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\Mainmenu.o.d
?????文件??????158146??2010-05-27?12:27??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\Timing.o
?????文件?????????127??2010-05-27?12:27??實(shí)驗(yàn)9李兵6091820503\build\Debug\MinGW-Windows\Timing.o.d
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\dist\
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\dist\Debug\
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\dist\Debug\MinGW-Windows\
?????文件??????898938??2010-05-27?12:53??實(shí)驗(yàn)9李兵6091820503\dist\Debug\MinGW-Windows\cppapplication_1.exe
?????文件??????????29??2010-05-27?13:47??實(shí)驗(yàn)9李兵6091820503\dist\Debug\MinGW-Windows\Equipage.txt
?????文件????????5766??2010-05-27?11:07??實(shí)驗(yàn)9李兵6091820503\Equipage.cpp
?????文件????????1432??2010-05-27?10:26??實(shí)驗(yàn)9李兵6091820503\Equipage.h
?????文件????????3663??2010-05-27?12:53??實(shí)驗(yàn)9李兵6091820503\main.cpp
?????文件???????37076??2010-05-27?11:45??實(shí)驗(yàn)9李兵6091820503\Mainmenu.cpp
?????文件????????1709??2010-05-27?10:49??實(shí)驗(yàn)9李兵6091820503\Mainmenu.h
?????文件????????3157??2010-05-22?08:16??實(shí)驗(yàn)9李兵6091820503\Makefile
?????目錄???????????0??2010-05-27?13:48??實(shí)驗(yàn)9李兵6091820503\nbproject\
?????文件????????2014??2010-05-22?08:17??實(shí)驗(yàn)9李兵6091820503\nbproject\configurations.xm
?????文件????????2189??2010-05-22?08:17??實(shí)驗(yàn)9李兵6091820503\nbproject\Makefile-Debug.mk
?????文件????????3759??2010-05-22?08:17??實(shí)驗(yàn)9李兵6091820503\nbproject\Makefile-impl.mk
?????文件????????2207??2010-05-22?08:17??實(shí)驗(yàn)9李兵6091820503\nbproject\Makefile-Release.mk
?????文件?????????888??2010-05-22?08:17??實(shí)驗(yàn)9李兵6091820503\nbproject\Makefile-variables.mk
?????文件????????1440??2010-05-22?08:17??實(shí)驗(yàn)9李兵6091820503\nbproject\Package-Debug.bash
............此處省略9個(gè)文件信息
評(píng)論
共有 條評(píng)論