Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Input validation code in Pascal

Posted on 2002-05-13
6
Medium Priority
?
471 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
[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
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 49

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

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.
Make the most of your online learning experience.
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

715 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