Program to ask date & days added to produce -c++ program, C/C++ Programming

 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();
 }


Posted Date: 10/22/2012 5:05:23 AM | Location : United States







Related Discussions:- Program to ask date & days added to produce -c++ program, Assignment Help, Ask Question on Program to ask date & days added to produce -c++ program, Get Answer, Expert's Help, Program to ask date & days added to produce -c++ program Discussions

Write discussion on Program to ask date & days added to produce -c++ program
Your posts are moderated
Related Questions
I need help with virtual memory manager implementation in C

(a) Write a procedure (count-even n) that counts the number of even digits in the decimal representation of the number n. For example, (count-even 234) should return 2. (b) Writ

how is a beti a beti

Binary search in array: - C program: Write a program in c to define binary search in array. void main()                 {                 clrscr();

#include #include #include #include #include class Employee { private: char *Name; //Set them as pointers... int IdNumber; char *Department; char *Position; public: voi

Structures A structure is a user-defined data type, which may have different data types as its members. Creating a structure is a two-part process. First, a structure template

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst. Shortest remaining time rst algori



1. When developing this project in a Win32 Console Applications that includes the precompiled headers, enter in the Name: box, PRJ2[Your Full Last Name][Your First Initial] with no