Question: I wrote this code on horse race simulation but how can i make it work with procedural style instead of using objects. #include //printf and

I wrote this code on horse race simulation but how can i make it work with procedural style instead of using objects.

#include //printf and NULL #include #include //srand and rand #include #include

using namespace std;

class Horse { public: int place; bool bWon; Horse(const int& iPos = 0) : place(iPos), bWon(false) {} void move_horse() { place += rand() % 2; } void win() { bWon = true; } int getplace(){ return place; } };

class Horse_Race{ public: Horse *h; int length; int iCount; bool bEnd; int winner; Horse_Race(int iHorses = 2, int iLen = 10){ iCount = iHorses; h = new Horse[iCount]; length = iLen; bEnd = false; } Horse_Race() { delete[] h; h = NULL; } void print() { cout << endl; for (int i = 0; i < iCount; i++) { for (int j = 0; j < h[i].getplace(); j++) { cout << "."; } cout << "(" << i << ")"; for (int l=h[i].getplace(); l < 15; l++) { cout << "."; } cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!