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

Assignment Help:

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



Related Discussions:- Program to ask date & days added to produce -c++ program

Sums a sequence of integers, assume that the first integer read with cin sp...

assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp

Arithmetic operation, a program that declares and prompts the user to enter...

a program that declares and prompts the user to enter two integer and performs the five arithmetic operations

Object oriented programming and cryptography, This assignment document will...

This assignment document will be distributed from Blackboard assignment folder. Some parts of the assignments will require you to research answers from your text book (you must rea

Explain abstract classes, Abstract Classes Abstract classes are the cla...

Abstract Classes Abstract classes are the classes, which are written just to act as base classes. Consider the following classes.                 class base

Write a program to sort an array of strings, Write a program to sort an arr...

Write a program to sort an array of strings. Use new and delete operators. Write a program to find the factorial of a number using recursion. If we do not accept the number

When should i use references, A: Use references when you can use, and use p...

A: Use references when you can use, and use pointers when you have to. References are generally preferred over pointers whenever you don't require "reseating". Usually this mean

Prob, Given an integer n and a permutation of numbers 1, 2 ... , n-1, n wri...

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

Simple text editor using c programming in linux environment, Deliverables: ...

Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the

Draw a picture using line - c program, Draw a picture using line: void...

Draw a picture using line: void main(void) {     int   driver = DETECT,mode;     int   x[10],y[10];     int   x_center = 360, y_center = 180, rad = 100;     int

C, algo of stack using two queue

algo of stack using two queue

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd