Ref Helper c++

I need some help finishing this c++ program that will act as a referees helper, does anyone have the time to help???



#include <iostream>
#include <iomanip>

using namespace std;



void ballPos(char pos, string hm, string vm, string *mas);
int score(int hscr, int vscr, char pos);


int main()

{



int yd=10, qrt=1, hscr=0, vscr=0, dwn=1, scr, p, ydg;

char pos, code, V, H, rd, N, again, tp;

string hm, vm, mas;

cout<<" Football Referre's Assistant version Fall 2015"<<endl;

do

{

cout<<"\n\nWhat is the home teams mascot? ";
getline(cin,hm);

cout<<"What is the visiting teams mascot? ";
getline(cin,vm);




cout<<"\n\nWhich Team will BEgin with the possession of the Ball (H/V)? ";

cin>>pos;





ballPos(pos,hm,vm,&mas);



cout<<"\nThe Event Codes are as follows: "<<endl;

cout<<"\nEvent Code Description\t Event Code\t Description"<<endl;

cout<<" y\tYardage made on play \t t\tBall turned over"<<endl;

cout<<" f\tField Goal \t \t q\tQuarter is over"<<endl;

cout<<" g\tGoal (Touchdown)\t p\tPenalty";

cout<<"\n s\tSafety \t\t\t c\tGame Canceled"<<endl<<endl;
do

{

cout<<"\nCurent Status: "<<qrt<<" Quarter\tBall Possession ";

cout<<pos<<"["<<mas<<"]"<<endl;

cout<<"Home ["<<hm<<"] "<<hscr<<"\tVistors ["<<vm<<"] "<<vscr<<"\t Down ";

cout<<dwn<<"\t "<<yd<<" yards to 1st down."<<endl;

cout<<"\nWhat event? ";

cin>>code;



switch(toupper(code))

{

case 'Y': "yardage gained";

cout<<"How many yards were gained on the play? ";

cin>>ydg;

yd-=ydg;

if (yd<0)

{

yd=10;

dwn=1;

}



if (yd<10)

{

dwn++;

if (dwn>4)

{

cout<<"Ball turned over";

dwn=1;

yd=10;

}

}

break;



case 'F': "Field Goal";

if (pos=='H')

hscr+3;

else

vscr+3;



break;



case 'G': "Goal";


cout<<"How many points extra points? "<<endl;

cin>>scr;

if (pos=='H')

hscr+=scr;

else

vscr+=scr;

break;



case 'S': "Safty";
if (pos=='H')

hscr+2;

else

vscr+2;

break;



case 'T': "Ball turned over";





break;



case 'Q': "Quarter over";

qrt++;

if (qrt>4)

{

cout<<"\nGame Over\tFinal Score\tHome ["<<hm<<"]\t"<<hscr;

cout<<"\tVisitors ["<<vm<<"]\t"<<vscr<<endl;

cout<<"############ "<<mas<<" Win!! ###############";

}

break;



case 'P': "Penalty";

cout<<"Which team (H/V)? ";

cin>>tp;

cout<<"Repeat of downs? (Y/N)";

cin>>rd;

if (toupper(rd==N)&& dwn<4)

{

dwn++;

if (dwn>4)

{

cout<<"Ball turned over";

dwn=0;

}

}



cout<<"Yards Penalized? ";

cin>>p;

if (tp==pos)

{

yd+=p;

if (dwn<4)

dwn++;

}

else

{

yd-=p;

if (dwn<4)

dwn++;

}

break;


case 'C': "Game Canceled";



break;



default: cout<<"Invalid Selection "<<endl;

}

}

while(code!='C');

cout<<" Is there another Game ";

cin>>again;

}

while (toupper(again!='N'));

cin.get();

cin.get();

return 0;

}


int possession(char poss, int hScore, int vScore, string hm, string vm, string *mas)

{





int scr = 0;



if (poss=='h')

{

scr=hScore;

*mas=hm;

}

else

{

scr=vScore;

*mas=vm;

}


return scr;



}
void ballPos(char pos, string hm, string vm, string *mas)

{

if (pos=='H')

*mas=hm;

else

*mas=vm;

return;

}

Last edited on
it does not keep track of a (touchdown) in the score, and also it doesnt turn the ball over to the other team. i am clueless, if anyone can help i will appreciate it.
Topic archived. No new replies allowed.