Показать сообщение отдельно
Старый 02.07.2010, 15:49   #9 (permalink)
Vladimir_S
Специалист
 
Регистрация: 27.08.2008
Адрес: Санкт-Петербург
Сообщений: 27,807
Сказал(а) спасибо: 340
Поблагодарили 583 раз(а) в 208 сообщениях
Репутация: 113184
По умолчанию

Так, ну вот что у меня получилось. Я руководствовался сформулированным заданием, а, поскольку там никакие корректировки, упорядочения списка и прочее не значатся, так я это и выбросил. Если это всё-таки нужно, можно ввести такие процедуры.
Код:
program lab7;
const
 Nstud_max=100;
type
    stud=record
               Familiya: string;
               um9: string;
               Ot4estvo: string;
               Pol : Char;
               DataRojd: string;
               gruppa : string;
               Matemat : Array[1..3] of byte;
               fizika: Array[1..3] of byte;
               istoriya : Array[1..3] of byte;
               informatika : Array[1..3] of byte;
               end;
var
   studfile:Text;
   recstud: Array[1..Nstud_max] of stud;
   BadStud:Array[1..Nstud_max] of Word;
   i,j,y,Nstud,Nbadstud:integer;

procedure org;
 Var i:Integer;
 begin
  Append(studfile);
  Repeat
   Inc(Nstud);
   with recstud[Nstud] do
    begin
     Writeln('Student N ',Nstud:3,':');
     writeln ('vvedite familiio (max 10 letters)');
     readln (familiya);
     writeln ('vvedite im9 (max 10 letters)');
     readln (um9);
     writeln ('vvedite ot4estvo (max 10 letters)');
     readln (ot4estvo);
     writeln ('vvedite pol (M/J)');
     readln (pol);
     writeln ('vvedite daty rojdenia');
     readln (DataRojd);
     writeln ('vvedite gryppy (max 4 letters)');
     readln (gruppa);
     for i:=1 to 3 do
      begin
       writeln ('matematika, cycl ',i);
       readln (Matemat[i]);
      end;
     for i:=1 to 3 do
      begin
       writeln ('fizika, cycl ',i);
       readln (fizika[i]);
      end;
     for i:=1 to 3 do
      begin
       writeln ('istoriya, cycl ',i);
       readln (istoriya[i]);
      end;
     for i:=1 to 3 do
      begin
       writeln ('informatika, cycl ',i);
       readln (informatika[i]);
      end;
     write (studfile,familiya);
     for i:=Length(familiya)+1 to 11 do Write(studfile,' ');
     write (studfile,'|'+um9);
     for i:=Length(um9)+1 to 11 do Write(studfile,' ');
     write (studfile,'|'+ot4estvo);
     for i:=Length(ot4estvo)+1 to 11 do Write(studfile,' ');
     write (studfile,'|',pol,'|',DataRojd);
     for i:=Length(DataRojd)+1 to 10 do Write(studfile,' ');
     write (studfile,'|'+gruppa);
     for i:=Length(gruppa)+1 to 4 do Write(studfile,' ');
     Write(studfile,'|');
     for i:=1 to 2 do write(studfile,Matemat[i],' ');
     write(studfile,Matemat[3],'|');
     for i:=1 to 2 do write(studfile,fizika[i],' ');
     write(studfile,fizika[3],'|');
     for i:=1 to 2 do write(studfile,istoriya[i],' ');
     write(studfile,istoriya[3],'|');
     for i:=1 to 3 do write(studfile,informatika[i],' ');
    end;
   WriteLn(studfile);
   write('prodoljit vvod?  1-da , 2- net ');
   readln(y);
  Until y=2;
 end; {org}


begin {prog}
 Nstud:=0;
 assign (studfile, 'C:/USP.DAT');
 rewrite (studfile);
 writeln (studfile,
' familiya     um9       ot4estvo    p  Datarojd grup. Matem  fiz.  ist. inf.');
 Writeln(studfile);
 org;
 Close(studfile);
 assign (studfile, 'C:/NEW.DAT');
 rewrite (studfile);
 Nbadstud:=0;
 For i:=1 to Nstud do
  begin
   with recstud[i] do
    begin
     y:=0;
     for j:=1 to 3 do
      if (Matemat[j]=2) or (fizika[j]=2)
         or (istoriya[j]=2) or (informatika[j]=2) then y:=1;
    end;
   If y=1 then
    begin
     INC(Nbadstud);
     BadStud[Nbadstud]:=i;
    end;
  end;

 For i:=1 to NbadStud do
  with recstud[BadStud[i]] do
   begin
    If pol='M' then Write(studfile, 'Dorogoy student ') else
    Write(studfile, 'Dorogaya studentka ');
    WriteLn(studfile, 'gruppy '+gruppa+' '+Familiya+' '+um9+' '+Ot4estvo+'!');
    WriteLn(studfile,'Soobshchaem Vam, chto u Vas imejutsa zadoljennosti po sledujushchim');
    WriteLn(Studfile,'discyplinam i cyclam:');
    for j:=1 to 3 do
     if Matemat[j]=2 then
       Writeln(studfile,'Matematika, cycl N',j);
     for j:=1 to 3 do
      if fizika[j]=2 then
       Writeln(studfile,'Fizika, cycl N',j);
     for j:=1 to 3 do
      if istoriya[j]=2 then
       Writeln(studfile,'Istoria, cycl N',j);
     for j:=1 to 3 do
      if informatika[j]=2 then
       Writeln(studfile,'Informatika, cycl N',j);
    Writeln(studfile,'V sluchae, esli Vy ne perezdadite ukazannyje predmety');
    Writeln(studfile,'v techenije 10 dney, Vy budete OTCHISLENY.');
    Writeln(studfile);
   end;
  Close(studfile);
end.
Vladimir_S вне форума   Ответить с цитированием
Ads

Яндекс

Member
 
Регистрация: 31.10.2006
Сообщений: 40200
Записей в дневнике: 0
Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
Репутация: 55070