Answer the question
In order to leave comments, you need to log in
C++ assignment?
They gave me a homework assignment using the C++ language
and I don’t know how to do it
:
A comet flies around the earth at N speed
Alibaba lives on earth for example 60 years
how many times Alibaba sees this comet in a lifetime
super program is not needed here
please explain how make this program (I just riley teapot)
Answer the question
In order to leave comments, you need to log in
here is pure mathematics input data:
speed (more than something and less than the speed of light - the real speed is such that the comet will not fall to the ground) and the orbit (verification is needed) from the upper boundary of the atmosphere to the orbit of the moon, minus the radius of the moon, minus some a safe margin so that the comet doesn't collide with anything.
when there is an orbit - we consider the circumference - this is one revolution.
now you need to find out how much the comet will have time to fly in this time - you need to find how many hours in 60 years, taking into account leap extra days,
the number of leap years is 60/4 (you need to round up to the nearest integer) - each leap year is an extra day
in one year 365 days
in one day 24 hours
found the number of hours - multiply by the speed that is given in kilometers per hour
found the distance in 60 years - divide it by the length of the orbit - round to the nearest integer
return the result.
variable types depending on the expected maximum values.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question