program for test scores

An applicant will be given a maximum of five typing tests. He/she will be hired as soon as the scores on two of the tests are over 50. The program should print 'Hire' as soon as the applicant qualifies without asking for further tests. If after five test scores have been entered and the typist still hasn't qualified, the program should print Reject. Here are two sample outputs:

enter score 52
enter score 47
enter score 54
Hire


enter score 41
enter score 48
enter score 52
enter score 49
enter score 48
Reject

Here is my code:
program TypingScore;
var score: integer;
      tries: integer;

begin
      tries := 0;
repeat
      tries := tries + 1;
      write ('Enter score: ');
      readln (score)
until (score > 50) or (tries = 5);
if score > 50 then
    writeln ('Hire;)
else writeln ('Reject');
end.

The program stops when I finally enter a score over 50.
kazooie21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alisher_NCommented:
var
  score, good, bad : integer;
begin
  good := 0; bad := 0;
  repeat
     write( 'enter score: ' );
     readln( score );
     if score > 50 then Inc( Good ) else Inc( Bad );
     if Good = 2 then begin writeln( 'hire' ); halt; end;
     if (Good+Bad) = 5 then begin writeln( 'reject'); halt; end;
  until False;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BatalfCommented:
Or like this :


var
  score, good, bad : integer;
  decision : boolean;
begin
  good := 0; bad := 0;
  decision:=false;
  repeat
     write( 'enter score: ' );
     readln( score );
     if score > 50 then Inc( Good ) else Inc( Bad );
     if Good = 2 then begin
            writeln( 'hire' );
            decision := true;
end;
     if (Good+Bad) = 5 then
        begin
          writeln( 'reject');
          decision:=true;
        end;
  until decision=true;


The program then don't need to halt.
0
Alisher_NCommented:
for batalf:

what is the difference ?
'halt' is normal (documented) way to exit from program, actually it does the same thing as 'end.', so I can't see any reason for your version. Moreover, mine was shorter=faster ;-)

0
BatalfCommented:
I was just posting an additional comment. All Credit should be given to you :-)
0
Alisher_NCommented:
sorry all!
I forgot to put 'end.' in my proposed answer ;-(

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.