Solved

for dbrunton

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 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