Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Case of...

Posted on 1998-02-20
1
Medium Priority
?
203 Views
Last Modified: 2010-04-16
I wonder how you uses a case set when you open a textfile wiht assign
I want to read from a file from the disk and print it on the screen, the text after the case set is going to be printed on the screen

. here is a example of my problem:
Assign(f,r);
      Reset(f);
if not Eof(f) then begin
readln(f,s);
writeln(S);
end;
while not Eof(f) do begin
read(f);
end;
Close(f);


case q of

'A'..'a':writeln ('First vocal in the abc ');        {a}
'E'..'e':writeln ('  Second vocal in the abc ');          {e}
 
0
Comment
Question by:kalle66
1 Comment
 
LVL 6

Accepted Solution

by:
tecbuilder earned 100 total points
ID: 1217361
Case statements only work on ordinal values.  Therefore, you need to convert your character variable q to ord function.  For example:  

case ord(q) of
  65, 97: writeln('First vocal in the abc');
  69, 101: writeln('Second vocal in the abc');
end;

Note:  A = 65 and a = 97.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month6 days, 5 hours left to enroll

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question