google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: C++ program to accept and dispaly data using class date

Saturday, February 21, 2015

C++ program to accept and dispaly data using class date

Create a c++ class date which contain:
-date
-month
-year
write necessary member function to accept and display a data using
<< and >> operator

#include<iostream.h>
#include<conio.h>
class date
{
int d,m,y;
public:void accept()
       {
       cout<<"\nenter date:-";
       cin>>d;
       cout<<"\nenter month:-";
       cin>>m;
       cout<<"\nenter year:-";
       cin>>y;
       }
       void display()
       {
       cout<<"\n\ndate:="<<d<<"-"<<m<<"-"<<y;
       }
};
int main()
{
date d;
clrscr();
d.accept();
d.display();
getch();
return 0;
}


-------------------------------------------------------------------------
OUTPUT


enter date:-21

enter month:-02

enter year:-2015


date:=21-02-2015

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...