Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help please- readkey not working

stuart1512stuart1512 Posts: 3Member
[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

  • singgasingga Posts: 41Member
    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.
  • AtexAtex Posts: 268Member
    Doesn't hurt if you insert this as 2nd line either: [b]uses crt;[/b]
  • est69dogest69dog Posts: 5Member
    it must be there bec readkey and keypressed are crt functions
Sign In or Register to comment.