Solved

Input validation in Pascal

Posted on 2002-05-13
3
754 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 100 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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…
Introduction to Processes

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