Solved

for dbrunton

Posted on 2000-03-28
2
214 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 48

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If your vDisk VHD file gets deleted from the image store accidentally or on purpose, you won't be able to remove the vDisk from the PVS console. There is a known workaround that is solid.
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 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

9 Experts available now in Live!

Get 1:1 Help Now