C++ Programming

#include<iostream>
#include<string>
using namespace std;
class Date{
int day;
string month;
int year;
public:
Date(){
day=1;
month="January";
year=2000;
}
Date(int d,string m,int y){
day=d;
month=m;
year=y;
}
void show(){
cout<<"\n Date is : "<<day<<"-"<<month<<"-"<<year<<endl;
}
};
int main(){
Date d;
Date d1(26,"March",2019);
d1.show();
return 0;
}

No comments:

Post a Comment