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
What are the different types of endless loops? An endless loop can be of two types: i.) A loop that is intentionally designed to go round and round until the condition withi

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

The rPeANUt simulator provides buffering of the characters that are typed into the terminal. However, this would generally not be the case so if the program did not consume a chara

Pure Virtual Functions An abstract class is one, which is used just for deriving some other classes. No object of this class is declared and used in the program. Likewise, ther

Write a C function to solve the system of linear equations A x = y where A is an N by N matrix in the format of pointer-to-pointers and y is a vector in the format of a pointer. Th

Converting Base Type to Class Type (char to string)   class String { char *name; int length; public: String(void) {length =0; name = new char[length+1];

Ask4. Write a query to display the columns listed below. The query should list each customer in which the video rental is overdue. The Days_Overdue column should calculate the numb

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec


Precedence and Order of evaluation The languages follow a standard precedence for basic operators. Precedence rules help in deleting ambiguity of the order of operations perfor