Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Input validation code in Pascal

Posted on 2002-05-13
6
Medium Priority
?
488 Views
Last Modified: 2010-04-17
Dear Programmers

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

Ask the user to input a number.  If the number is less than 0 or more than 100 the user is asked to
re-enter the number.
0
Comment
Question by:cybernursery
6 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7006599
Or did you misunderstood the teacher?

We're not allowed to do your homework. I'm sorry if my messages were a bit weird and stupid, but we're not allowed to do that for you. Homework is intended to be made by you as to learn from it...

CJ
0
 
LVL 50

Expert Comment

by:dbrunton
ID: 7006702
It's a repeat loop



repeat

code

until  number_meets_requirements

OK, now you have to work out what number_meets_requirements is.

Hmm, if this is homework or schoolwork which is what it seems, you have serious problems if you don't understand this type of pascal construct.
0
 

Accepted Solution

by:
eddiejr earned 200 total points
ID: 7007139
That's the answer:

program GetNumber;

var
  Number: integer;
begin
  write('Enter a number (0..100): ');
  repeat
    readln(Number);
  until (Number > 0) and (Number < 100);
end.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:nrico
ID: 7008471
eddie... :(

If people will keep doing his work for him he'll never learn to do something this simple himself.
0
 

Author Comment

by:cybernursery
ID: 7009518
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
 
LVL 22

Expert Comment

by:CJ_S
ID: 7009536
Both of you violate EE's rules. I will inform community support about this.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is about my first experience with programming Arduino.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

927 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