Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
help please- readkey not working Posted by stuart1512 on 3 Nov 2009 at 4:40 AM
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-



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.


Report
Re: help please- readkey not working Posted by singga on 3 Nov 2009 at 7:14 AM
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; (*It should be := instead of =: Also, readkey unfound *)
If Choice := 'V' Then (*It should be Choice = 'V'*)
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.
Report
Re: help please- readkey not working Posted by Atex on 4 Nov 2009 at 7:43 PM
Doesn't hurt if you insert this as 2nd line either: uses crt;
Report
Re: help please- readkey not working Posted by est69dog on 1 Jun 2010 at 2:55 AM
it must be there bec readkey and keypressed are crt functions



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.