C/C++の宿題を片付けます 64代目
■ このスレッドは過去ログ倉庫に格納されています
0807デフォルトの名無しさん
2006/05/15(月) 21:21:31結局タイプミスの修正以外は何もやらなかったと…。
#include <stdio.h>
#define TAB_WIDTH (8)
int main()
{
int c;
int width=0, maxwidth = 0;
while ((c = getchar()) != EOF) {
switch(c) {
case '\n':
if (width > maxwidth)
maxwidth = width;
width = 0;
break;
case '\t':
width += TAB_WIDTH;
width -= width % TAB_WIDTH;
break;
default:
width++;
}
}
if(width > maxwidth)
maxwidth = width;
printf("%d \n ", maxwidth);
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています