在C中循环帮助

use*_*514 0 c printing scanf while-loop

我是C编程的新手,我来自Java背景.我想知道为什么在下面的代码中,在while循环中我必须输入十次输入,然后显示所有十个输入.我想尝试输入一次并立即显示.然后继续输入我的其他输入.

#include <stdio.h>
#include <stdlib.h>
#include "Helper.h"


main(){

print(PROGRAM_INFO); //prints program name and author
print(PROMPT);

char input [100]; //array to hold input from user
int isActive = 1; //1 continue shell, 0 terminate shell
int count = 0;

while (isActive == 1 && count < 10){
    print(PROMPT);
    ++count;
    scanf("%s", input);
    print(input);


}


}
Run Code Online (Sandbox Code Playgroud)

Mit*_*eat 5

fflush(stdout)每次尝试后冲洗print(input)