help please- readkey not working

[size=4][color=Blue]i have a problem. i built the code below but the readkey doesnt seem to be working, i get 3 problems- 2 of them are "error: illegal expression" and the other is "fatal: syntax error,;expected but identifier READKEY found"


please help

here is my code-[/color][/size]


[color=Red]program Lesson6Task3;

var
sLen:Integer;
sSearch,D:String;
mString,sString:String;
intPos,intLen:String;
Choice:Char;

begin
Writeln('Please enter a string or sentence');
Readln(mString);
Writeln('please choose functon');
Writeln('V- View the string');
Writeln('F- find the length of the string');
Writeln('S- search the string');
Writeln('D- Delete part of the string');
Writeln('C- Clear the string');
Choice=:readkey;

If Choice:= 'V' Then
begin
Writeln(mString);
end;

If Choice:= 'F' Then
begin
sLen := Length(mString);
end;

If Choice:= 'S' Then
begin
sSearch := Pos (D)
end;

If Choice:= 'D' Then
begin
Readln(mString);
Writeln('What do you want to delete from the string');
readln(sString);
intpos :=Pos (sString, mString);
intLen :=Length:=(sString);
Delete(mString, intPos, intLen)
end;

If Choice:= 'C' Then
begin
Readln(' ', sLen);
Readln(' ', sSearch);
Readln(' ', mString);
Readln(' ', sString);
Readln(' ', intPos);
Readln(' ', intLen);
end;

Else
Writeln('Please choose one of the funtions');

end.[/color]

Comments

  • program Lesson6Task3;

    var
    sLen:Integer;
    sSearch,D:String;
    mString,sString:String;
    intPos,intLen:String;
    Choice:Char;

    begin
    Writeln('Please enter a string or sentence');
    Readln(mString);
    Writeln('please choose functon');
    Writeln('V- View the string');
    Writeln('F- find the length of the string');
    Writeln('S- search the string');
    Writeln('D- Delete part of the string');
    Writeln('C- Clear the string');
    Choice=:readkey; [u][b](*It should be := instead of =: Also, readkey unfound *) [/b][/u]
    If Choice := 'V' Then [u][b](*It should be Choice = 'V'*)[/b][/u]
    begin
    Writeln(mString);
    end;

    If Choice:= 'F' Then
    begin
    sLen := Length(mString);
    end;

    If Choice:= 'S' Then
    begin
    sSearch := Pos (D)
    end;

    If Choice:= 'D' Then
    begin
    Readln(mString);
    Writeln('What do you want to delete from the string');
    readln(sString);
    intpos :=Pos (sString, mString);
    intLen :=Length:=(sString);
    Delete(mString, intPos, intLen)
    end;

    If Choice:= 'C' Then
    begin
    Readln(' ', sLen);
    Readln(' ', sSearch);
    Readln(' ', mString);
    Readln(' ', sString);
    Readln(' ', intPos);
    Readln(' ', intLen);
    end;

    Else
    Writeln('Please choose one of the funtions');

    end.
  • Doesn't hurt if you insert this as 2nd line either: [b]uses crt;[/b]
  • it must be there bec readkey and keypressed are crt functions
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories