home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / TGARTS.ZIP / SAMPLE.ZIP / TGVOTE.PAS < prev   
Pascal/Delphi Source File  |  1998-12-20  |  1KB  |  60 lines

  1.  
  2. Program New;
  3.  
  4. Uses Crt;
  5.  
  6. {$I telegard.inc}
  7.  
  8. VAr Vote_file : file of voterec;
  9.     Vote_Rec  : Voterec;
  10.     Bull_file : text;
  11.     Vote_data : Array[1..numvoteqs] of voterec;
  12.     Total_Rec : Byte;
  13.     Loop,loop2 : Byte;
  14.     Temp,Adesc : String;
  15.  
  16. Procedure read_data;
  17. Var Cnt : Byte;
  18. Begin
  19.   Clrscr;    Cnt := 0;
  20.   Assign(Vote_file,'voting.dat');
  21.   Reset(Vote_file);
  22.   While not eof(vote_file) do
  23.   Begin
  24.     Inc(Cnt);
  25.     Read(vote_file,vote_rec);
  26.     Vote_data[Cnt]:= vote_rec;
  27.   end;
  28.   Close(Vote_file);
  29. end;
  30.  
  31. Begin
  32.   Read_data;
  33.   For Loop := 1 to 20 do
  34.   Begin
  35.     Vote_rec := vote_data[loop];
  36.     If vote_rec.active then
  37.     Begin
  38.       Assign(bull_file,'Vote'+chr(64+loop)+'.msg');
  39.       Rewrite(bull_file);
  40.       Writeln(Bull_file,'`0A      Bulltin of Voting results');
  41.       Writeln(Bull_file);
  42.       Writeln(Bull_file,'`0Bfor '+vote_rec.question);
  43.       str(vote_rec.numusers,temp);
  44.       Writeln(bull_file,'`0Ethere were '+temp+' users who voted on this question.');
  45.       For loop2 := 1 to vote_rec.numans do
  46.       Begin
  47.         adesc := vote_rec.answer[loop2].desc;
  48.         Writeln(bull_file,'`0F Answer:'+adesc);
  49.         str(vote_rec.answer[loop2].numres,temp);
  50.         Writeln(Bull_file,'`0F  Votes:'+temp);
  51.      end;
  52.       Close(Bull_file);
  53.     end;
  54.   end;
  55.   Textcolor(14);
  56.   Writeln('Bulletins were generated.  Look for Vote?.msg');
  57.   Writeln('Where ? is a letter from A-T.');
  58. end.
  59.  
  60.