Click to See Complete Forum and Search --> : grandia


dragoncut
June 17th, 2003, 10:17 PM
Here's the senairo..

Batman is chasing Joker. Joker has Joker Mobile and Batman has Bat Mobile, Joker has a headstart on batman, but batman mobile goes faster than joker mobile. Print out there distance everyhalf hour until batmobile catch up to joker mobile or pass it.

You can like ask user to put following input.

What's the Joker Headstart? (cannot be less than 0)
Note: Batmobile starts at 0
What's the speed of Joker Mobile?
What's the speed of Bat Mobile? (cannot be less than Joker Mobile)

What throw's me off is, how do i actually write a code that prints out there closing distance every half hour until bat mobile catch up to him or passes it. I know i have to use d = r * t formula, but i dont know how to use it in c++ with this following problem..

Can Anyone please help!
You'll be god send if you do.

kuphryn
June 18th, 2003, 01:10 AM
One solution is a loop. You could set the loop to be, say 1 unit time, for each iteration.

Kuphryn