Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 27.05.2013, 20:35   #1
ardena
Новичок
Джуниор
 
Регистрация: 27.05.2013
Сообщений: 2
Восклицание Допущена ошибка Pascal ABC

Помогите найти ошибки и отредактировать их.
Задание:
Структура должна включать не менее 10 столбцов, в том числе – строковые, числовые и дата, всего в таблице должно быть не менее 30 строк.
В приложении должны реализовываться следующие функции и элементы:
* загрузка и сохранение данных в типизированный файл с любым (допустимым в ОС) именем;
* ввод, редактирование, поиск и удаление строк;
* просмотр данных в табличной форме;
* формирование отчетов в текстовый файл;
* подсчет максимальных и минимальных значений, сумм и средних значений для числовых полей;
Тематика : справочник по странам
Код:
   Program laba_88;
     uses crt,graphabc;
      Const Razm = 50;
      Type
          Book  =  record
                    Nom : integer;
                    Avt : string[15];
                    Naz : string[25];
                    Izd : string[15];
                    Language:string[12];
                    Genre:string[12];
                    TypeOfBinding:string[20];
                    CityEdition:string[20];
                    ListOfAuthors:string[20];
                    god : integer;
                   end;
      Var
         B_files : file of Book;
         RecBook : Book;
         i,k,n_zap, nom               : integer;
         fv: text;
         st: array[1..10] of string;
         r: char;
     Procedure Formaliz;
     Begin
      assign(B_files,'bibl.txt');
      rewrite(B_files);
       with RecBook do
        begin
         for i:=1 to Razm do
          begin
           Nom:=i;
           Avt:=' ';
           Naz:=' ';
           Izd:=' ';
           Language:='';
           Genre:='';
           TypeOfBinding:='';
           CityEdition:='';
           ListOfAuthors:='';
           god:=1900+random(113);
           write(B_files,RecBook);
          end;
        end;
        close(B_files);
     End;
 Procedure Correct;
          Begin
      assign(B_files,'bibl.txt');
      reset (B_files);
       write(' Сколько записей будете вносить ? ');
       readln(N_zap);
        with RecBook do
         for i:=1 to N_zap do
          begin
           write(' Введите номер книги :');
           readln(Nom);
           write(' Введите фамилию автора: ');
           readln(Avt);
           write(' Введите название книги: ');
           readln(Naz);
           write(' Введите  издательство:  ');
           readln(Izd);
           write(' Введите язык: ');
           readln(Language);
           write(' Введите жанр: ');
           readln(Genre);
           write(' Введите тип переплета: ');
           readln(TypeOfBinding);
           write(' Введите город издания: ');
           readln(CityEdition);
           write(' Введите список авторов: ');
           readln(ListOfAuthors);
           write(' Введите  год издания: ');
            
            
            
           readln(god);
           Seek(B_files,Nom-1);
           write(B_files,RecBook);
          end;
         close(B_files);
      End;
ardena вне форума Ответить с цитированием
Старый 27.05.2013, 20:36   #2
ardena
Новичок
Джуниор
 
Регистрация: 27.05.2013
Сообщений: 2
По умолчанию

Весь код не вошёл
Код:
      Procedure Vyvod;
           Begin
      assign(B_files,'bibl.txt');
      reset (B_files);
       write(' Укажите номер просматриваемой строки ');
       readln(Nom);
                  Seek(B_files,Nom-1);
           read(B_files,RecBook);
           writeln(recbook.nom:4,recbook.avt:20, recbook.naz:20, recbook.izd:15,
             recbook.language:12,recbook.genre:12,
            recbook.typeOfBinding:20, recbook.cityEdition:20,
            recbook.listOfAuthors:20,recbook.god:5);
           readkey;
 
         close(B_files);
      End;
 
          Procedure Vyvod_all;
           Begin
 
      assign(B_files,'bibl.txt');
      reset (B_files);
       with RecBook do
        while not EOF (B_files) do
         begin
          read(B_files,RecBook);
          writeln(nom:4, Avt:20,Naz:30,Izd:20,god:5,Language:12,
          Genre:12,TypeOfBinding:20,CityEdition:20,ListOfAuthors:20);
         end;
       close(B_files);
       End;
      
         Procedure Vyvod_all_file;
           Begin
 
      assign(B_files,'bibl.txt');
      reset (B_files);
      assign(fv,'vyvod.txt');
      rewrite(fv);
       with RecBook do
        while not EOF (B_files) do
         begin
          read(B_files,RecBook);
          writeln(nom:4, Avt:20,Naz:30,Izd:20,Language:12,
          Genre:12,TypeOfBinding:20,CityEdition:20,ListOfAuthors:20);
          writeln(fv, nom:4, Avt:20,Naz:30,Izd:20,god:5,Language:12,
          Genre:12,TypeOfBinding:20,CityEdition:20,ListOfAuthors:20);
         end;
       close(B_files);
       close(fv);
       End;
      
        Procedure statist;
        var
        sum,n: integer;
        max,min: integer;
        sred: real;
         nm: array[1..razm] of integer;
           Begin
 
      assign(B_files,'bibl.txt');
      reset (B_files);
      sum:=0;   n:=0;
       with RecBook do
        while not EOF (B_files) do
         begin
          read(B_files,RecBook);
          n:=n+1;
          nm[n]:=nom;
           sum:=sum+nom;
         end;
         
       close(B_files);
 
       sred:=sum/50;
       writeln('Сумма ',sum:4);
       writeln('Среднее ',sred:10:2);
       min:=nm[razm]; max:=nm[1];
       for i:=1 to razm do
       begin
        if nm[i]>max then max:=nm[i];
        if nm[i]<min then min:=nm[i];
        end;
        writeln('Минимум =',min);
        writeln('максимум =',max);
       readkey;
       End;
       
        Procedure sort;
        var
        n,j,b: integer;
         mn: array[1..razm] of integer;
           Begin
 
      assign(B_files,'bibl.txt');
      reset (B_files);
      n:=0;
       with RecBook do
        while not EOF (B_files) do
         begin
          read(B_files,RecBook);
          n:=n+1;
          mn[n]:=god;
         end;
 
       close(B_files);
             for j:=razm downto 2 do
          for i:=1  to  j-1   do
            if mn[i]>mn[i+1] then
               begin
                  b:=mn[i];
                  mn[i]:=mn[i+1];
                  mn[i+1]:=b;
               end;
    for i:=1 to razm do writeln(mn[i]:10);
 
 
       readkey;
       End;
       
       Procedure poisk;
        var
        min,max: integer;
        n,j,b: integer;
         mn: array[1..razm] of integer;
           Begin
 
      assign(B_files,'bibl.txt');
      reset (B_files);
      n:=0;
       with RecBook do
        while not EOF (B_files) do
         begin
          read(B_files,RecBook);
          n:=n+1;
          mn[n]:=god;
         end;
 
       close(B_files);
       write( 'Введите нижнюю границу ');
       readln(min);
        write( 'Введите верхнюю  границу ');
       readln(max);
            for i:=1  to  razm   do
            if (mn[i]>min) and (mn[i]<max) then
            writeln(mn[i]:10);
 
 
       readkey;
       End;
       
      begin
 
st[1]:='Создание пустой базы';
st[2]:='Корректировка записей';
st[3]:='Вывод одной строки';
st[4]:='Вывод всей базы';
st[5]:='Создание текстового файла';
st[6]:='Статистика';
st[7]:='Сортировка';
st[8]:='Поиск';
st[9]:='Выход';
for i:=1 to 9 do  textout(20,10+(i-1)*20,st[i]);
i:=1;
setfontcolor(clRed);
textout(20,10+(i-1)*20,st[i]);
repeat
r:=readkey;
case r of
#80: begin
        setfontcolor(clblack);
        textout(20,10+(i-1)*20,st[i]);
        i:=i+1; if i=10 then i:=1;
        setfontcolor(clRed);
        textout(20,10+(i-1)*20,st[i]);
         end;
 #72: begin
        setfontcolor(clblack);
        textout(20,10+(i-1)*20,st[i]);
        i:=i-1; if i=0 then i:=9;
        setfontcolor(clRed);
        textout(20,10+(i-1)*20,st[i]);
         end;
 end;
 until (r=#13) or (r=#27);
 clrscr;
 if i=1 then  Formaliz;
      if i=2 then correct;
      if i=3 then  Vyvod;
      if i=4 then  Vyvod_all;
      if i=5 then  Vyvod_all_file;
      if i=6 then  statist;
       if i=7 then  sort;
        if i=8 then  poisk;
        if i=9 then exit;
      end.
ardena вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
pascal abc, pascal turbo. выборка данных из одного .txt в другой ТипичныйСтудент Помощь студентам 6 27.04.2013 15:29
в Pascal ABC.Net ошибка:"невозможно явно преобразовать тип integer к System.random" ameks94 Паскаль, Turbo Pascal, PascalABC.NET 3 23.12.2012 02:04
Программы в Pascal, среда pascal ABC. Лабораторные работы Одинокая Волчица Фриланс 8 10.02.2012 20:09
Неудобство ABC Pascal и глюк Borland Pascal proser93 Помощь студентам 0 19.11.2011 19:01
Допущена ошибка,не знаю как исправить sSilen Помощь студентам 8 08.01.2011 20:56