Making the simplifying assumption that one year equals 365 days. Then divide by 365 to get the years, and modulo 365 to get the days left over.
int days_time = alpha_centauri_days / per_speed ;
cout <<"The time required to reach alpha centauri at "<< percent
<< " percent of light speed is: \n"<< days_time/365 << " years!\t" << days_time%365 << " days!\n";
You don’t need the year_time
variable.
solved 4.5 years supposed to be 4 years and 178, How I can do that In C++