this program is to ask a date amp also ask


 THIS PROGRAM IS TO ASK A DATE & ALSO ASK FOR DAYS TO BE ADDED TO PRODUCE


#include
#include

struct date
 {
  int dd;
  int yy;
  int mm;
 };
void main()
 {
 clrscr();
 int day;
 date dot;
 cout<<" enter the date (dd/mm/yy) ";
 cin>>dot.dd>>dot.mm>>dot.yy;
 cout<<" input the days to be added ";
 cin>>day;
  dot.dd +=day;
  if (dot.mm ==1 || dot.mm ==3 ||  dot.mm ==5 || dot.mm ==7 || dot.mm ==8 ||
      dot.mm ==10 || dot.mm ==12)
   {
   if(dot.dd>=31)
     {
     dot.dd-=31;
     dot.mm++;
     }
   }
   else
   if(dot.mm ==4 ||  dot.mm ==6 || dot.mm ==9 || dot.mm ==11)
    {
    if(dot.dd>=30)
     {
     dot.dd-=30;
     dot.mm++;
     }
    }
   else
   if (dot.mm ==2 && dot.yy%4==0)
     {
     dot.dd-=29;
     dot.mm++;
     }
   else
      {
      dot.dd-=28;
      dot.mm++;
      }
   if (dot.mm>12)
     {
     dot.mm-=12;
     dot.yy++;
     }
  cout<<" new date:- "<  getch();
 }


Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: this program is to ask a date amp also ask
Reference No:- TGS0175256

Expected delivery within 24 Hours