Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Input validation in Pascal

Posted on 2002-05-13
3
Medium Priority
?
764 Views
Last Modified: 2008-02-01
Dear Programmers

Could you please supply me with a piece of code in Pascal (Turbo 7) to answer the following problem:

Declare an array N which contains 30 cells of integer type and prompt the user to read in 30 integers between 0 and hundred.

Validity of input between 0 and 100 is important.
0
Comment
Question by:cybernursery
[X]
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
3 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7006592
Homework?
0
 

Accepted Solution

by:
eddiejr earned 400 total points
ID: 7007155
program FillArray;

var
  I: byte;
  N: array[1..30]of integer;
  Value: integer;

begin
  writeln('This program fills an array of 30 elements with values between 0..100');
  for I := 1 to 30 do begin
    writeln('Enter a value (0..100) for element ', I, ' : ');
    repeat
      readln(Value);
    until (Value >= 0) and (Value <= 100);
  end;
end.
0
 

Author Comment

by:cybernursery
ID: 7009526
First of all thanks to eddiejr,   I was aware of the code but I wanted to be sure that I answered correctly.  This was my first time.  Next time I paste the code and ask for your comments.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Starting up a Project

597 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