I need someone to complete my program for me , it shouldn't take very long as I've already done most of the source.cpp
The task is to create a 'magicke ball' game where the user unputs either L or R (left or right) and sends the ball down a series of switches
which are either on or off, the user then receives an output of 1 or 0 based on weather the ball reached the exit or not.The user can either input one Input and get one Output, or input a sequence of Inputs and get a sequence of Outputs back.
The program has to be Object Orientated and feature the use of pointers and classes
I am willing to pay a HEFTY ammount for this, but it has to be complete before Thursday 30th April 10 PM.
PM me for more info if you're willing to do this. Thanks!my code so far, technically I only need the flipper.cpp code left, but I struggle hard with pointers and how to link all the objects.
Code
#include "flipper.h"
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
// ----------- INPUTS ----------------\\
char interactiveInput() //function to find out L or R input
{
char input[1];
cout << "\nPlease type in R to send the ball to \nthe right switch or L to send the ball left." << endl << "> ";
cin >> input;
return input[1]; //return L or R
}
char bufferedInput() //function to find out L or R input sequence
{
char input[50];
cout << "\nPlease type in R to send the ball to \nthe right switch or L to send the ball left." << endl << "> ";
cin >> input;
return input[50]; //return L or R sequence
}
//------------ OUTPUTS ----------------\\
bool interactiveOutput(char singleInput[1])
{
bool output;
//if ball reaches the end without getting stuck at switches
//then return 1
//otherwise return 0
return output;
}
long bufferedOutput(char sequenceInput[50])
{
long output;
//return 1 if ball reaches end
//and 0 if it doesnt
//return a sequence of 1s and 0s
//depending on the sequence of
//L's and R's inputted by user
return output;
}
int main()
{
bool inputType;
char singleInput[1];
char sequenceInput[50];
singleInput[1] = interactiveInput();
sequenceInput[50] = bufferedInput();
//start
cout << "Hi and welcome to the magick ball game" << endl;
cout << "Which type of input would you like? 0 = Interactive or 1 = Buffered?" << endl << "> ";
cin >> inputType; //input selector
if (inputType == 0)
{
cout << "You have selected Interactive type.\nthis means you will get your \nresult shown straight after \nyour input." << endl;
interactiveInput(); //call interective function and get single input
interactiveOutput(singleInput);//call interactive output function by using single input
}
else
cout << "You have selected Buffered type. \nthis means you can input a sequence \nof inputs and you will get \na sequence of outputs back." << endl;
bufferedInput(); //call buffered function and get sequence input
bufferedOutput(sequenceInput); //call buffered output function by using sequence input
} //end main
Flipper Header
Code
#include <iostream>
#include <string>
using namespace std;
class flipper
{
public:
//left and right sides of the flipper
flipper(int left, int right, bool switched);
//get the left or right side of the flipper
int getLeft();
int getRight();
void setexitRight(flipper*); //set exit right
void setexitLeft(flipper*); //set exit left
int switchFlipper();
//check if balls exits or runs into next flipper
flipper* getexitRight();
flipper* getexitLeft();
int changeBallState();
private:
int left, right;
bool switched;
flipper* exitLeft, *exitRight; //pointers
};
This post was edited by Absolution on Apr 28 2015 12:09pm