Program to compare the two dates given by the user, C/C++ Programming


 THIS PROGRAM IS TO COMPARE THE TWO DATES GIVEN BY THE USER



#include
#include
#include

struct date
 {
  int dd;
  int mm;
  int yy;
 };

date compare(date d1,date d2)
 {
  if (d1.dd   {
   cout<<" 2nd date day is bigger ";
   }
   else if(d2.dd   {
   cout<<" 1nd date day is bigger ";
   }
   else if(d1.dd==d2.dd)
   {
    cout<<" ";
   }
  if (d1.mm   {
   cout<<" 2nd month is bigger ";
   }
  else
   {
   cout<<" 1nd month day is bigger ";
   }
  if(d1.yy>d2.yy)
   {
   cout<<" 1st date is bigger " ;
   }
  else if (d1.dd==d2.dd && d1.mm==d2.mm && d1.yy==d2.yy );
   {
   cout<<" the dates are equal ";
   }
  if(d2.yy>d1.yy)
   {
   cout<<" 2nd date is bigger ";
   }
 }


void main()
  {
  clrscr();
  date d1,d2,ans;
  cout<<" enter the 1st date (dd/mm/yyyy) ";
  cin>>d1.dd;
  cin>>d1.mm;
  cin>>d1.yy;
  cout<<" enter the 2nd date (dd/mm/yyyy) ";
  cin>>d2.dd;
  cin>>d2.mm;
  cin>>d2.yy;
  compare(d1,d2);
  }











Posted Date: 10/22/2012 5:03:49 AM | Location : United States







Related Discussions:- Program to compare the two dates given by the user, Assignment Help, Ask Question on Program to compare the two dates given by the user, Get Answer, Expert's Help, Program to compare the two dates given by the user Discussions

Write discussion on Program to compare the two dates given by the user
Your posts are moderated
Related Questions
It tells the compiler that a variable or a function exists, even if the compiler hasn't yet seen it in the file presently being compiled. This variable or function may be distinct

Friend Functions One of the major features of OOP is information hiding. A class encapsulates data and methods to operate on that data in a single unit. The data from the class

create two array names and grade .in first array you have to store thease 10 names 1.a,2.3.r,4.s,5.l,6.k,7.n,8.b,9.z,10.d you have to enter grades for thease students.te program mu

I need website Product section search box coding section fix Project Description: On our products section in the search box it only searches the name and title of our product

write c program to do the following : -fill 2 dimensional array (square matrix array with size=4). -ask the user to enter any integer number and add this number to the diagonals -o

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

wap to read an employee salary and calculate DA,HRA,pf,GROSS,NET conditions:- BASIC DA HRA PF >10000 7% 9% 10% & >20000 9% 11% 15% &

C program to remove vowels in sentence : void main() {                 char  str[100];                 int n;                 printf("enter string\n");

Can you help me with a C++ project?

Define Keywords in C++ K e y w o r d s: K e y w o rd s a r e t h e w o rd s a l r e a d y u s e d b y C + + i n i t s c