Need help for this statement?

closed account (4wRjE3v7)
How would I write a statement related to a game where if your shot (lets say you are playing football) lands anywhere between five meet of the actual goal area, they win so how would I write this?

For example if the shot is at 1000 ft and the goal is at 1005 they win but how would I do this?

If I already have if statements that indicate if they wont to far or too short

ex:
1
2
3
4
5
6
7
8
9
10
11
if(shot>goal)
{
cout<< "too far"
}


if (shoat<goal)
{
cout<< "Not enough"
}



thanks in advance
If goal is at distance = 50 meters, the winning area would be between 45 meters and 55 meters.

1
2
3
4
if((shot > (goal + 5)) || (shot < (goal - 5))) //If the shot distance is not within goal +- 5
   player lost
else
   player won
Topic archived. No new replies allowed.