C - Remove and replace printed items

后端 未结 3 1851
生来不讨喜
生来不讨喜 2021-01-14 02:21

I\'m writing a program in C compiled in gcc. The question relates to homework, but the specific part I need help with is not part of the homework assignment. A similar que

相关标签:
3条回答
  • 2021-01-14 03:04

    If I get your question, please try this:

    system("cls");
    

    and print a new text on the console.

    EDIT:

    Also, to answer your second question, have a while loop and:

    use getch() found in conio.h
    

    So that you need not wait for the enter key to be pressed as in the scanf.

    0 讨论(0)
  • 2021-01-14 03:08

    Use the \b (backspace) character.

    printf("Quick brown fox");
    int i;
    for(i=0; i < 9; i++)
    {
        printf("\b");
    }
    printf("green fox\n");
    

    I noticed that putting a \n on the first printf() messed up the output.

    0 讨论(0)
  • 2021-01-14 03:09

    Doing those console manipulations is dependent on the platform that you are using. You will probably need a library to accomplish what you are trying to do. See something like this which is cross platform, or the old conio library for DOS if you're on Windows.

    0 讨论(0)
提交回复
热议问题