Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Case of...

Posted on 1998-02-20
1
178 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 50 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

If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

861 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