Write a C++ Program to display entered Date
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#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 ::
1 2 3 4 5 |
Enter Year:2016 Enter Month:12 Enter Day:28 Today’s Date in dd/mm/yyyy format:28/12/2016 |