Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

for dbrunton

Posted on 2000-03-28
2
Medium Priority
?
221 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 49

Accepted Solution

by:
dbrunton earned 40 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Let's take a look into the basics of ransomware—how it spreads, how it can hurt us, and why a disaster recovery plan is important.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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