#include<graphics.h>
#include<conio.h>
using namespace std;
void main()
{
TCHAR buffer;
TCHAR a[10] ;
int i = 0;
initgraph(640, 480);
RECT b = { 0,0,100,50 };
rectangle(0, 0, 100, 50);
while (true)
{
if(kbhit())
{
buffer =_getch();
if (i <= 10)
{
if ((buffer >= 'a'&&buffer <= 'z')||(buffer >= 'A'&&buffer <= 'Z')||(buffer >= '0'&&buffer <= '9'))
{
a[i] = buffer;
drawtext(a, &b, DT_LEFT);
i++;
}
}
}
}
_getch();
closegraph();}
#include<conio.h>
using namespace std;
void main()
{
TCHAR buffer;
TCHAR a[10] ;
int i = 0;
initgraph(640, 480);
RECT b = { 0,0,100,50 };
rectangle(0, 0, 100, 50);
while (true)
{
if(kbhit())
{
buffer =_getch();
if (i <= 10)
{
if ((buffer >= 'a'&&buffer <= 'z')||(buffer >= 'A'&&buffer <= 'Z')||(buffer >= '0'&&buffer <= '9'))
{
a[i] = buffer;
drawtext(a, &b, DT_LEFT);
i++;
}
}
}
}
_getch();
closegraph();}