Solved

for dbrunton

Posted on 2000-03-28
2
213 Views
Last Modified: 2010-04-16
I added the code you told me to get rid of the Error 200, instead of outputting the averages it outputs 'No candidates found'



var name: string;
    numb: integer;
    totalnumb: integer;
    wt: integer;
    totalwt: integer;
    applicants: integer;
    AppFile: text;
    avgnumb: real;
    avgwt: real;
    posit: string;

procedure GETDATA (var localAppFile: text;
                   var localname: string;
                   var localnumb: integer;
                   var localwt: integer);

  begin
    readln (localAppFile, localname);
    readln (localAppFile, localnumb);
    readln (localAppFile, localwt);
  end; {GETDATA}

procedure POSITION(var localnumb: integer;
                   localwt: integer;
                   posit: string);

    begin
      if (numb < 10) and (wt < 180) then
        begin
          writeln ('Accepted ');
          posit := 'Accepted';
        end
      else
        begin
           writeln ('Rejected ');
           writeln ('Your weight is more than the given weight ');
           writeln ('The number of cigarettes you smoke is over the limit ');
           posit := 'Not accepted';
        end;
    end; {POSITION}


procedure ACCEPTED ( posit: string;
                     localwt: integer;
                     localnumb: integer);

   begin
      if (posit = 'Accepted') then
        begin
          totalwt := localwt + totalwt;
          totalnumb := totalnumb + localnumb;
          inc(applicants);
        end;
   end;{ACCEPTED}


begin {main}
  assign (AppFile, 'A:\AppFile2.dat');
  reset (AppFile);
  while not seekeof (AppFile) do
     begin
        GETDATA (AppFile, name, numb, wt);
        POSITION (numb, wt, posit);
        ACCEPTED (posit, wt, numb);
     end;
        if applicants <> 0 then
          begin
            avgnumb := totalnumb / applicants;
            writeln ('Average number of ciagrettes for accepted applicants is ', avgnumb:6:2);
            avgwt := totalwt / applicants;
            writeln ('Average weight for accepted applicants is ' , avgwt:6:2);
          end
        else
          writeln ('No candidates found');

end.

0
Comment
Question by:kazooie21
2 Comments
 

Author Comment

by:kazooie21
ID: 2666894
Adjusted points from 5 to 10
0
 
LVL 47

Accepted Solution

by:
dbrunton earned 10 total points
ID: 2667864
Change this line

procedure POSITION(var localnumb: integer;
                                      localwt: integer;
                                      posit: string);


to

procedure POSITION(var localnumb: integer;
                                      localwt: integer;
                                      var posit: string);

This posit is not returning with the value.  Sorry for delay.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A Short Story about the Best File Recovery Software – Acronis True Image 2017
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now