#include <iostream>
using namespace std;
class calendar {
private:
int datenum[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
string ansmonth[7] = { "SUN", "MON", "TUE", "WED", "THU" , "FRI", "SAT" };
int month;
int date;
int sumofdays;
public:
void setDate() {
cin >> month >> date;
sumofdays = 0;
}
void coutdays() {
while (month > 1) {
month -= 1;
sumofdays += datenum[month - 1];
}
sumofdays += date;
}
void printdate() const{
switch (sumofdays % 7) {
case 0:
cout << "SUN";
break;
case 1:
cout << "MON";
break;
case 2:
cout << "TUE";
break;
case 3:
cout << "WED";
break;
case 4:
cout << "THU";
break;
case 5:
cout << "FRI";
break;
case 6:
cout << "SAT";
break;
}
}
};
int main(void) {
calendar c;
c.setDate();
c.coutdays();
c.printdate();
}
'백준 알고리즘 > 구현' 카테고리의 다른 글
백준 2839 c++ (0) | 2019.01.01 |
---|---|
백준 10871 c++ (0) | 2019.01.01 |
백준 3053번 파이썬 (0) | 2018.10.01 |
백준 2490번 파이썬 (0) | 2018.09.30 |
백준 5430 파이썬 (0) | 2018.09.24 |