• 大小: 407KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: C/C++
  • 标签: 游戏  

资源简介

用C++编写的强大赛马游戏,完全用类进行构建,学习类之间的交流,学习开发游戏很有帮助。

资源截图

代码片段和文件信息

/* 
 * 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 < temp_string.size(); i++) {
             if (!isalpha(temp_string[i])&&!isspace(temp_string[i])&&static_cast(temp_string[i])!=46&&static_cast(temp_string[i])!=58)
                isAlpha = 0;
        }
 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-05-27 13:48  实验9李兵6091820503\
     文件         144  2010-05-27 13:38  实验9李兵6091820503\.dep.inc
     目录           0  2010-05-27 13:48  实验9李兵6091820503\build\
     目录           0  2010-05-27 13:48  实验9李兵6091820503\build\Debug\
     目录           0  2010-05-27 13:48  实验9李兵6091820503\build\Debug\MinGW-Windows\
     文件      170546  2010-05-27 12:27  实验9李兵6091820503\build\Debug\MinGW-Windows\Equipage.o
     文件         100  2010-05-27 12:27  实验9李兵6091820503\build\Debug\MinGW-Windows\Equipage.o.d
     文件      230690  2010-05-27 12:53  实验9李兵6091820503\build\Debug\MinGW-Windows\main.o
     文件         118  2010-05-27 12:53  实验9李兵6091820503\build\Debug\MinGW-Windows\main.o.d
     文件      344775  2010-05-27 12:27  实验9李兵6091820503\build\Debug\MinGW-Windows\Mainmenu.o
     文件         131  2010-05-27 12:27  实验9李兵6091820503\build\Debug\MinGW-Windows\Mainmenu.o.d
     文件      158146  2010-05-27 12:27  实验9李兵6091820503\build\Debug\MinGW-Windows\Timing.o
     文件         127  2010-05-27 12:27  实验9李兵6091820503\build\Debug\MinGW-Windows\Timing.o.d
     目录           0  2010-05-27 13:48  实验9李兵6091820503\dist\
     目录           0  2010-05-27 13:48  实验9李兵6091820503\dist\Debug\
     目录           0  2010-05-27 13:48  实验9李兵6091820503\dist\Debug\MinGW-Windows\
     文件      898938  2010-05-27 12:53  实验9李兵6091820503\dist\Debug\MinGW-Windows\cppapplication_1.exe
     文件          29  2010-05-27 13:47  实验9李兵6091820503\dist\Debug\MinGW-Windows\Equipage.txt
     文件        5766  2010-05-27 11:07  实验9李兵6091820503\Equipage.cpp
     文件        1432  2010-05-27 10:26  实验9李兵6091820503\Equipage.h
     文件        3663  2010-05-27 12:53  实验9李兵6091820503\main.cpp
     文件       37076  2010-05-27 11:45  实验9李兵6091820503\Mainmenu.cpp
     文件        1709  2010-05-27 10:49  实验9李兵6091820503\Mainmenu.h
     文件        3157  2010-05-22 08:16  实验9李兵6091820503\Makefile
     目录           0  2010-05-27 13:48  实验9李兵6091820503\nbproject\
     文件        2014  2010-05-22 08:17  实验9李兵6091820503\nbproject\configurations.xml
     文件        2189  2010-05-22 08:17  实验9李兵6091820503\nbproject\Makefile-Debug.mk
     文件        3759  2010-05-22 08:17  实验9李兵6091820503\nbproject\Makefile-impl.mk
     文件        2207  2010-05-22 08:17  实验9李兵6091820503\nbproject\Makefile-Release.mk
     文件         888  2010-05-22 08:17  实验9李兵6091820503\nbproject\Makefile-variables.mk
     文件        1440  2010-05-22 08:17  实验9李兵6091820503\nbproject\Package-Debug.bash
............此处省略9个文件信息

评论

共有 条评论