Solved

Case of...

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A safe way to clean winsxs folder from your windows server 2008 R2 editions
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now