= 작성자의 페이지 = 02 장재니 [Genie] = 소스 = {{{~cpp #include using namespace std; int main(){ int year, month; int theFirstDay; char day[7][4] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; int numOfMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; cout << "Input Year : "; cin >> year; cout << "Input month : "; cin >> month; if ( year % 4 == 0 && ( year % 100 != 0 || year % 400 == 0 ) ) numOfMonth[1] = 29; theFirstDay = ( --year * 365 + year / 4 - year / 100 + year / 400 + 1 ) % 7; for (int i = 1 ; i < month ; i++){ theFirstDay = ( theFirstDay + numOfMonth[i - 1] ) % 7; } cout << "SUN\tMON\tTUE\tWED\tTHU\tFRI\tSAT" << endl; for (i = 0 ; i < theFirstDay ; i++) cout << "\t"; for (i = 0 ; i < numOfMonth[month - 1] ; i++){ if ( ( theFirstDay + i ) % 7 == 0 && i != 0 ) cout << endl; cout << i + 1 << "\t"; } cout << endl; return 0; } }}} ---- ["만년달력"]