#define _CRT_SECURE_NO_WARNINGS
//#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define WEEK "日 月 火 水 木 金 土"
char disp[8][80];
void strfmt(void* dest, char* fmt, int i)
{
char buf[8];
}
void cal(int year, int month)
{
struct tm tm;
struct tm* ptm;
time_t timer;
int line;
int i;
for (i = 0; i < 8; i++) {
disp[i][79] = '\0';
}
strfmt(disp[0], "%d", year);
strfmt(disp[0] + 8, "%d月", month);
tm.tm_year = year - 1900;
tm.tm_mon = month - 1;
tm.tm_mday = 1;
line = 2;
for (i = 1; i <= 31; i++) {
if (ptm->tm_mon != month - 1) {
break;
}
if (ptm->tm_wday == 0 && 1 < i) {
line++;
}
strfmt(disp[line] + ptm->tm_wday * 3, "%2d", i);
timer += 24 * 60 * 60;
}
for (i = 0; i < 8; i++) {
}
}
int main()
{
cal(2012, 6);
return 0;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19XQVJOSU5HUwovLyNpbmNsdWRlIDxjb25pby5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8dGltZS5oPgoKI2RlZmluZSBXRUVLICLml6Ug5pyIIOeBqyDmsLQg5pyoIOmHkSDlnJ8iCgpjaGFyIGRpc3BbOF1bODBdOwoKdm9pZCBzdHJmbXQodm9pZCogZGVzdCwgY2hhciogZm10LCBpbnQgaSkKewoJY2hhcgkJYnVmWzhdOwoKCXNwcmludGYoYnVmLCBmbXQsIGkpOwoJbWVtY3B5KGRlc3QsIGJ1Ziwgc3RybGVuKGJ1ZikpOwp9Cgp2b2lkIGNhbChpbnQgeWVhciwgaW50IG1vbnRoKQp7CglzdHJ1Y3QgdG0JdG07CglzdHJ1Y3QgdG0qCXB0bTsKCXRpbWVfdAkJdGltZXI7CglpbnQJCWxpbmU7CglpbnQJCWk7CgoJZm9yIChpID0gMDsgaSA8IDg7IGkrKykgewoJCW1lbXNldChkaXNwW2ldLCAnICcsIDc5KT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