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
Write a program to calculate e^x using the formula: e^x = 1 + x/1! + x^2/2! + x^3/3! + ...... Allow the user to enter the integer number x, then do the calculation in a loop (for

why oops

how to make the coding

A: In C++ the access privileges are public, private and protected. The default access level assigned to members of a class is private. Private members of any class are accessible o

Prepare Windows Shell Extension Project Description: Skills required are C++ Programming, Windows Desktop, Windows API

Classes and Objects A class is a vehicle to execute the OOP features in the C++ language. Once a class is declared, an object of that type can be explained. An object is said t

overloadstream insertion opertator to display the data of object on the console

develop a C program for Linux called pipes.c that does the following: In the main() function, it creates a pipe using the pipe() function, then creates two child processes with

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

Threaded binary tree: Consider the linked illustration of a binary tree 'T.  Approximately half of the entries is the pointer fields 'LEFT' and 'RIGHT' will have null elements. Th