Backup proyecto Joyfe - Borland
This commit is contained in:
54
CPP/CURSOR.CPP
Normal file
54
CPP/CURSOR.CPP
Normal file
@ -0,0 +1,54 @@
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
char i=0, a=0;
|
||||
int col,sw=0;
|
||||
int fil;
|
||||
void main()
|
||||
{
|
||||
clrscr();
|
||||
fflush(stdin);
|
||||
gotoxy(10,10);
|
||||
printf("Mueve cursor:");
|
||||
|
||||
while(sw==0)
|
||||
{
|
||||
//gotoxy(wherex(),wherey());
|
||||
i=getche();
|
||||
col=wherex();
|
||||
col--;
|
||||
fil=wherey();
|
||||
if(i==0)
|
||||
{
|
||||
//printf("dentro de i=0");
|
||||
a=getch();
|
||||
|
||||
switch(a)
|
||||
{
|
||||
case 72:
|
||||
{
|
||||
gotoxy(col,fil-1);
|
||||
// printf("col= %d, fil= %d",col,fil);
|
||||
// getch();
|
||||
break;
|
||||
}
|
||||
case 80:
|
||||
gotoxy(col,fil+1);
|
||||
break;
|
||||
case 77:
|
||||
gotoxy(col+1,fil);
|
||||
break;
|
||||
case 75:
|
||||
gotoxy(col-1,fil);
|
||||
break;
|
||||
}
|
||||
// getch();
|
||||
}
|
||||
else
|
||||
sw=1;
|
||||
}
|
||||
printf("fin");
|
||||
getch();
|
||||
fflush(stdin);
|
||||
clrscr();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user