?
Solved

Input validation in Pascal

Posted on 2002-05-13
3
Medium Priority
?
759 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Simple Linear Regression
Suggested Courses

752 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