Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DATE.CPP
- #include "Date.h"
- string Date::setMonth(string month)
- {
- Date Date;
- transform(month.begin(),month.end(),month.begin(), toupper);
- cout << "Date.Month is:" << month << endl;
- if (month=="AUG"||month=="SEP"||month=="OCT"||month=="NOV"||month=="DEC"||month=="JAN"||month=="FEB"||month=="MAR"||month=="APR"||month=="MAY"||month=="JUN"||month=="JUL"){
- Date.month(month);
- return Date.month;
- }
- else{
- return Date.month("JAN");
- }
- }
- string Date::getMonth()
- {
- Date Date;
- return Date.month;
- }
- /*
- Date::Date()
- {
- Date Date;
- Date.year=0;
- Date.day=0;
- Date.month="";
- }
- Date::Date(int yr,int d,string mon)
- {
- Date Date;
- Date.year=yr;
- Date.day=d;
- Date.month=mon;
- }
- */
- DATE.HPP
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- class Date
- {
- int year, day;
- string month;
- public:
- /*
- Date();
- Date(int year,int day,string mon);
- */
- static string Date::setMonth(string month);
- static string Date::getMonth();
- };
- MAIN.CPP
- #include "Date.h"
- int main()
- {
- Date Date;
- string month;
- cout << "Enter month:";
- cin >> month;
- Date.setMonth(month);
- cout << "Main calling getMonth():" << Date.getMonth() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement