Q:

Write a C++ Program to display entered Date

0

Write a C++ Program to display entered Date

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
using namespace std;
class date
{
        private:
                        int dd,mm,yyyy;
        public:
                void input();
                void display();
};
void date::input()
{
        cout<<"Enter Year:";
        cin>>yyyy;
        cout<<"Enter Month:";
        cin>>mm;
        cout<<"Enter Day:";
        cin>>dd;
}
void date::display()
{
        cout<<"Today's Date in dd/mm/yyyy format:"<<dd<<"/"<<mm<<"/"<<yyyy;
}
int main ()
{
 date d;
 d.input();
 d.display();
}
 
 

OUTPUT ::

Enter Year:2016
Enter Month:12
Enter Day:28

Today’s Date in dd/mm/yyyy format:28/12/2016

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Classes and Objects Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C++ program to display Student details usi... >>
<< C++ program to find Square of a Number using inlin...