Salve a tutti io ho questo codice fatto da me solo che non riesco a far spostare il cursore come mai?:
codice:
#include <stdlib.h>
#include <conio.h>
#include <iostream>
#include "crt.h"
using namespace std;
int main()
{
char tasto1=' ',tasto2=' ';
int cx=1,cy=1;
TextBackground(WHITE);
clrscr();
TextColor (BLUE);
do
{
tasto1 = getch();
if ((tasto1 >= 32)&&(tasto1<=127)){
cout<<tasto1;
cx++;
}
if (tasto1 == 13){
cy++;
cx = 1;
gotoxy(cx,cy);
}
if ((tasto1 == 0)|| (tasto1 == -32)){
tasto2 = getch();
//cout<< int(tasto2)<<" Tasto cursore o tasto funzione "<<endl;
switch (tasto2){
case 72 : if (cy > 1) cy = cy--; gotoxy(cx,cy);break;
case 75 : if (cx > 1) cx = cx--; gotoxy(cx,cy);break;
case 77 : if (cx < 80) cx = cx++; gotoxy(cx,cy);break;
case 80 : if (cy < 25) cy = cy++; gotoxy(cx,cy);break;
}
}
}while(tasto1!=27);
system("pause");
return 0;
}
grazie a tutti coloro che mi aiuteranno