居然不能用‘\b', 呜呜

P1067 [NOIP2009 普及组] 多项式输出

BaCl2_ @ 2024-09-16 10:34:01

为什么用 '\b' 会说 on line 1 column 1, read 1, expected x. 求解释。

#include <iostream>

using namespace std;

int main() {
    int n, a, i;

    scanf("%d", &n);

    for (i=n; i>=0; i--) {
        scanf("%d", &a);

        if (a == 0) continue;

        if (a > 0 && i != n)
            printf("+");
        printf("%d", a);
        if (a == 1 || a == -1)
            printf("\b");
        if (i > 0)
            printf("x^%d", i);
    }
    printf("\n");

    return 0;
}

by cff_0102 @ 2024-09-16 10:41:38

@BaCl2_ 因为你会输出 1 \b x ^ ...


by Edogawa_Conan @ 2024-09-16 10:43:30

@BaCl2_ LG文件爱你读入输出,你用freopen试试会发生什么


by BaCl2_ @ 2024-09-16 10:52:29

@cff_0102 明白了,谢谢


by BaCl2_ @ 2024-09-16 10:52:59

@Edogawa_Conan 懂了,谢谢


by Edogawa_Conan @ 2024-09-16 10:53:29

@BaCl2_ 求关


|