C/C++の宿題を片付けます 113代目

このエントリーをはてなブックマークに追加
982デフォルトの名無しさん
[1] 授業単元: プログラミング
[2] 問題文:時計を表示するプログラムを作る
(書きかけのソースは下に書きます。)
[3] 環境
 [3.1] OS: WindowsXP
 [3.2] Borland C++ ver5.0.0
 [3.3] 言語:C
[4] 期限:今日
[5] その他の制限:よくわからないですが、ポインタ辺りまでならいいと思います。
最上段の年月日と曜日がうまく表示されません。
どなたかお願いしますm(__)m
983982:2008/07/23(水) 01:00:40
#include <stdio.h>#include <time.h> #include <conio.h>
void main()
{
static char *week[] = {"日", "月", "火", "水", "木", "金", "土"};
time_t now, prev;
struct tm *tm_now;
printf("\033[2J");
prev = now;
tm_now = localtime(&prev);
printf("\033[10;30H");
printf("%4d年%2d月%2d日 %s曜日\n",
tm_now->tm_year+1900, tm_now->tm_mon+1, tm_now->tm_mday, week[tm_now->tm_wday]);
for(;;){
if(kbhit()){
if(getch() == 0x1B) break;
}
prev = now;
now = time(NULL);
if(prev == now)
continue;
tm_now = localtime(&now);
printf("\033[11;30H");
printf("%2d時%2d分%2d秒\n",
tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec);
}
}