### LOST!!!!

need help finishing up program for class, no tutoring at school to help. i have the hole be random from 0 to 5000feet. then allow players to alternate hitting ball. I cant get the game to be over if someone wins. how would i do this?
A)one player hits the ball in the hole, they win
b)both players hits the ball in hole, nobody wins
c)1 player hits ball out of bounds they lose
d)both players hits out of bounds they both lose
e)if nobody hits ball in hole the closest to the hole wins.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298`` `````` void swampGolf() { char hole,option,dis,rad; double xPlayer,yPlayer,xHole,yHole,horizontalAngleB; double horizontalDistance,x1,x2,y1,y2,distance,dx,dy; int missed=0,count=0,rounds=6; srand(time(0)); for(int x=0;x<1;++x) xHole=1+(rand() % 5000); yHole=xHole; srand(time(0)); for(int x=0;x<1;++x) xPlayer=1+(rand() % 5000); yPlayer=xPlayer; cout<<"Welcome to Swamp Golf!!!"<>hole; //Tiger Woods for(double round=1;round>option; if(option=='a') { if(hole=='1') { horizontalDistance=stroke(); cout<<"horizontalDistance="<=-10) { cout<<"Congrats you made it!"<5000) cout<<"OUT of BOUNDS!!"<>dis; while(dis !='y'&& dis!='n') {cout<>dis;} cout<<"Do yo want to find the Radius?(y/n)"<>rad; while(rad !='y'&& rad!='n') {cout<>rad;} if(dis=='y'){ distanceInput(x1,x2,y1,y2); distance=distanceTotal(x1,x2,y1,y2); displayDistance(distance);} if(rad=='y') {angleInput(x1,x2,y1,y2); horizontalAngleB= angleTotal(x1,x2,y1,y2,dx,dy); displayAngle(horizontalAngleB);} } else if(option=='c') { cout<<"Pass"<>option; if(option=='a') { if(hole=='1') { horizontalDistance=stroke(); cout<<"horizontalDistance="<=-10) { cout<<"Congrats you made it!"<5000) cout<<"OUT of BOUNDS!!"<yPlayer) cout<<"Tiger Woods is the winner!"<xPlayer) cout<<"Phil Mickelson is the winner!"<>type; cout<<"What is the % of force of the swing (0 to 100%)"; cout<<" example: 50% will be type in as 0.5"<>force; while(force<0||force>1) { cout<>force; } if(type=='3') elevationAngleE=20; else if(type=='5') elevationAngleE=40; else if(type=='7') elevationAngleE=60; else elevationAngleE=80; initialVelocityV=force*150; horizontalDistance=elevationTotal(elevationAngleE,initialVelocityV); return horizontalDistance; } void displayDestination(double x2, double y2) { cout<<"x Coordinates of destination(feet)="<
Topic archived. No new replies allowed.