注册 登录
编程论坛 C++教室

请大家帮忙找错。。。。zoj上1099

xiaoqiang120 发布于 2010-02-01 18:41, 568 次点击
只有本站会员才能查看附件,请 登录

为什么在zoj上一直是Presentation Error,请高手解释。。。
2 回复
#2
xiaoqiang1202010-02-01 19:36
顶  请帮忙
#3
flylee2010-02-01 20:07
程序代码:

#include <stdio.h>
#include <string.h>

int main()
{
    int count;
    char buf[82];
    count = 0;
    while(scanf("%s", buf) != EOF) {
        if(!strcmp(buf, "<br>")) {
            putchar('\n');
            count = 0;
        }
        else if(!strcmp(buf, "<hr>")) {
            if(count) putchar('\n');
            for(count = 80; count; --count) putchar('-');
            putchar('\n');
        }
        else {
            if(count + strlen(buf) + 1 > 80) {
                printf("\n%s", buf);
                count = strlen(buf);
            }
            else {
                if(count) putchar(' ');
                printf("%s", buf);
                count += strlen(buf) + 1;
            }
        }
    }
    return 0;
}


我的代码,已ac
1