this program is to ask user to input two


 /*
 THIS PROGRAM IS TO ASK USER TO INPUT TWO DATE & PRODUCE A NEW DATE

 */
#include
#include

struct date
 {
  int dd;
  int yy;
  int mm;
 };
date add(date d1,date d2)
   {
  date temp;
  temp.dd=d1.dd+d2.dd;
  temp.mm=d1.mm+d2.mm;
  temp.yy=d1.yy+d2.yy;
   if(temp.dd>=30)
     {
     temp.dd-=30;
    temp.mm++;
     }
  else
   if(temp.dd>=31)
     {
    temp.dd-=31;
    temp.mm++;
     }
  else
   if(temp.dd>=28)
      {
    temp.dd-=28;
    temp.mm++;
      }
 if(temp.mm>=12)
      {
     temp.mm-=12;
     temp.yy++;
      }
   return temp;
   }
void main()
  {
  clrscr();
  date d1,d2,ans;
  cout<<" enter the 1st date (dd/mm/yyyy) ";
  cin>>d1.dd;
  cin>>d1.mm;
  cin>>d1.yy;
  cout<<" enter the 2nd date (dd/mm/yyyy) ";
  cin>>d2.dd;
  cin>>d2.mm;
  cin>>d2.yy;
  ans=add(d1,d2);
  cout<<" new date:-"<  }

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: this program is to ask user to input two
Reference No:- TGS0175253

Expected delivery within 24 Hours