Solved

for dbrunton

Posted on 2000-03-28
2
217 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
[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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article was initially published on Monitis Blog, you can read it here . When it comes to deciding which approach to website performance monitoring is best for your business, unfortunately, like so many options in life . . . it depends. In t…
This article was originally published on Monitis Blog, you can check it  here .   Some years back, I worked as the CTO.  During my tenure, I had a head of IT support reporting to me.  He did his job quite well and had a commendable sense of duty…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 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