The goal here is to write a code that will calculate whether or not a water balloon can be dropped on someone depending on how far away they are, how fast they are walking, and comparing how long it will take them to reach the hit box vs how long for the balloon to drop.
An example output is meant to look like this:
How far away is your friend(feet)? 200
How fast are they walking(feet/sec)? 3
How high are you before dropping your ballon(feet)? 100
It will take 66.66 seconds for them to reach the balloon point
It will take 4.57 seconds for your balloon to travel to the ground
If you wait 62.09 seconds, you will hit them
This is all I have so far. I know it's not much, but I'm going to continue working on it and I'd just like some tips for how best to proceed so I don't waste time. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int velocity = 0;
int distance = 0;
int verDist;
int speed;
int horDist;
int time1;
cout <<"How far away is your friend(feet)?: ";
cin >> verDist;
cout <<"How fast is your friend walking(feet/sec)?: ";
cin >> speed;
cout <<"How high are you dropping the balloon from(feet)?: ";
cin >> horDist;
}
|