求高玩解惑 能否在窗口中实现数据的动态变化?

问题大概就是:有输入一栏还有输出一栏,然后在输入的同时输出栏也在同步变化(不需要使用回车就可以进行)?
下面的代码是输入一行字符,以'.'结尾。输入其中所有的字母字符。
现在困惑的是,能不能不用回车,输入一个字符,输出也同步,在最后输入'.'时结束程序。

#include<stdio.h>
int main()
{
    char a[80];
    printf("输入: ");
    gets(a);
    int i=0;
    int sum=0;
    while(a[i]!='.')
    {
        if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
        {
            sum++;
            printf("%c ",a[i]);
        }
        i++;
    }
    return 0;
}

试试下面这个:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wincon.h>
#include <conio.h>

void gotoxy(int x, int y)
{
    HANDLE hOut;
    COORD pos = { x,y };                          // 光标的起始位(第1列,第3行) 0是第1列 2是第3行
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut, pos);       //printf("定位光标位置搜索(%d,%d)\n",pos.X,pos.Y);
}
int main()
{
    char a[80];
    printf("输入: ");
    int i = 0;
    int sum = 0;
    char ch = 0;
    gotoxy(1 + i, 4);
    while (1)
    {
        if (kbhit())
        {
            ch = getch();
            gotoxy(1 + i, 4);
            printf("%c", ch);
            gotoxy(1 + i, 6);
            printf("%c", ch);
            i++;
            gotoxy(1 + i, 4);
        }
    }
    return 0;
}