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
Hiding overloaded functions We cannot overload a base class function by redefining it in a derived class with a dissimilar argument list. Consider examples to see if similar fu

Write a program in C that you will name "divide.exe", to divide one 32-bit twos-complement binary number by another, giving the quotient and the remainder, using the subtract-shift

answer for tcs is working question

Find out the largest torque: A flat belt is taken in use to transmit torque from pulley A to pulley B as shown in figure given below. The radius of each pulley is 50mm and co

1. Basic Heap: Each memory location in our model of the RAM will be an instance of type Memory: 2. typedef union Memory_u Memory; 3. union Memory_u{ 4. char character;


Assume that a Binary Search Tree is constructed by repeatedly inserting exact values in to the tree. Argue that the number of nodes examined in searching for a value in the tree is

P o i n t e r d e c l a r a t i o n f o r me m b e r f un c t i o n : M e t h o d 1 : W h e n C l a ss i s n o t

Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

Write a program to create a binary file and store the following data "hello", 0x0030,'1', 1.234  Using visual studio examine the binary file and note how the day is stored   Answe