Hi folks. I'm pretty new to pascal 7.0 and desire help if any are willing.
What I'm trying to do:
When a user presses "a", the cursor will move 5 spaces to the right. If I replace the last 'x' in the last 'gotoxy' with '10', the program works. But I need the function to return the value of X. Here is the code
program stupid;
uses crt;
var
arrowkey : char;
x, y : integer;
tmp : char;
function MoveCursorX(X : Integer): Integer;
begin
x := (x+5);
end;
begin
x:=5;
y:=5;
gotoxy(x,y);
arrowkey := readkey;
if arrowkey = chr(65) then
MoveCursorX(X);
gotoxy(x,y);
readln(tmp);
end.
Thanks in advance for your help.
What I'm trying to do:
When a user presses "a", the cursor will move 5 spaces to the right. If I replace the last 'x' in the last 'gotoxy' with '10', the program works. But I need the function to return the value of X. Here is the code
program stupid;
uses crt;
var
arrowkey : char;
x, y : integer;
tmp : char;
function MoveCursorX(X : Integer): Integer;
begin
x := (x+5);
end;
begin
x:=5;
y:=5;
gotoxy(x,y);
arrowkey := readkey;
if arrowkey = chr(65) then
MoveCursorX(X);
gotoxy(x,y);
readln(tmp);
end.
Thanks in advance for your help.