Question: help to finish my c + + code please Write a program that has the user enter an integer value representing some number of days

help to finish my c++ code please Write a program that has the user enter an integer value representing some number of days (a large number). You need to
verify that the number entered is a positive number, if not the user should be given the opportunity to enter another value.
Properly using the modulus operator and if/else statements print out the number of years that the number entered
represents, if there are days left over, those should also be provided.
Note: If there are no days left over, then the days should NOT be printed.
There are four screenshots for this problem:
Screenshot 1: A large enough number to have years and days.
Please enter the number of days to convert to years
890
There are 2 years and 160 days in 890 days.
Screenshot 2: A large enough number for no days remaining, exact year count.
Please enter the number of days to convert to years
1825
There are 5 years in 1825 days.
Screenshot 3: A number that is not large enough to determine years.
Please enter the number of days to convert to years
285
A year is made of 365 days.
You have not entered a large enough value to determine
the number of years.
Screenshot 4: User entering an invalid number.
Please enter the number of days to convert to years
-35
You have entered an invalid number.
Please run the program again.#include
int main(){
int days;
// Prompt the user for input until a positive integer is entered
do {
std::cout "Enter the number of days (a large number): ";
std::cin >> days;
if (days =0){
std::cout "Please enter a positive number.
";
}
} while (days =0);
// Calculate years and remaining days
int years = days /365;
int remainingDays = days %365;
// Output the result
std::cout "Number of years: " years;
if (remainingDays >0){
std::cout ", remaining days: " remainingDays;
}
std::cout std::endl;
return 0;
}
 help to finish my c++ code please Write a program that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!