Tuesday, 21 October 2014

Write a program that takes current date and date of birth as input and calculate the number of days from date of birth to current date....!!

Leave a Comment
/*  Programmed by http://cppexamples.blogspot.com
                   Simple and easy coding for beginners*/
#include<iostream>#include<conio.h>using namespace std;int main(){    int day,month,year,cday,cmonth,cyear,tyear,tmonth,tday,leap=0;    cout<<"Enter your date then month then year of birth : ";    cin>>day>>month>>year;    cout<<"Enter current date , month than year: ";    cin>>cday>>cmonth>>cyear;    tyear=cyear-year;    tmonth=12*tyear;    tday=365*tmonth;    for ( ; year<=cyear ; year++)   //this loop is calculating the leap years which came in your life    {        if (year%4==0)            leap++;    }    tday+=leap;    cout<<"Your number of days from birth to current date are: "<<tday<<endl;    return 0;    getch();}
If You Enjoyed This, Take 5 Seconds To Share It