What is the best way to calculate a date difference?

Creating a c++ program asking the user to enter a date in the format DD MM YYYY?

  • Given a date of format DD MM YYYY where YYYY >= 2000, write a C++ program to: 1. Find the next date (you may ignore the special case of leap years). 2. Calculate your age up to the given date. 3. Check if the same date DD MM has passed or not in the current year. If not calculate how many days are left. Your program must validate the given date and display an appropriate message if it is not valid. Thank you in advance. I started with #include < iostream > but i'm not sure if this is enough, shall I add something to it? maybe < iomanip >?! and then using namespace std; main () { int dd; int mm int YYYY; ^ this is where I declared the variables. & then: cout<< " Enter Date In The Format (dd mm YYYY): "; //Accept Entire Date cin>>dd; cin>>mm; cin>>YYYY; and then for the validation i chose to use if statement (since i'm asked to use either if or else statement and the while loop statement for this assignment) this way { if(YYYY < 2000) cout << "enter a valid value for YYYY"; return 0; } and then I wasn't sure what does Find the next date mean. i thought it may mean the day that comes after the date the user enters? so in that case we will have an increment dd++ for the value of the day dd for 2.calculate your age i did not know what function to use to calculate the age. So if you could help me you'd be doing me a HUGE favor. Thanks!

  • Answer:

    ──────▄▌▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀… ───▄▄██▌█(@)(@)> RELAX <(@)(@) ▄▄▄▌▐██▌█ ███████▌█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄… ▀(@)▀▀▀▀▀▀▀(@)(@)▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀(@…

Sara at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.