Разработка программы обработки массива данных с построением диаграммы (предметная область-«Меню»)

Автор работы: Пользователь скрыл имя, 11 Марта 2013 в 21:13, курсовая работа

Описание работы

Система программирования Turbo Pascal, разработанная американской корпорацией Borland, является одной из самых популярных систем программирования в мире. Пакет Borland Pascal 7.0 учитывает многие новейшие достижения в программировании и практике создания программ( в том числе программ обработки статистических данных) и включает в себя три режима работы: в обычном режиме операционной системы MS DOS, в защищенном режиме MS DOS и в среде Windows. Обладая расширенными возможностями, пакет Borland Pascal 7.0 тем не менее требует для использования всех своих возможностей довольно большую память – примерно 30 Мбайт на жестком диске и не менее 2 Мбайт оперативной памяти.

Содержание работы

Министерство образования РФ 1
Введение 5
1 Постановка задачи на разработку программы 6
2 Состав и структура исходных данных и результатов 7
3 Методы решения задач 9
4 Описание программы 11
5 Методика отладки программы 12
6 Руководство пользователя 15
Заключение 19
Литература 20
ПРИЛОЖЕНИЕ A. Схема программы 30
ПРИЛОЖЕНИЕ Б. Текст программы 33
ПРИЛОЖЕНИЕ В. Результаты работы программы 43

Файлы: 1 файл

Kursovoi.doc

— 606.50 Кб (Скачать файл)

    Readln(nazv);                                                            

10:30

    Readln(nazv);                                                            

{$i-}                                                                        

M2:Write( 'Введите вес блюда: ');                                           

    Readln(ves);                                                             

    {$i+}                                                                    

    if(IOResult<>0 )or (ves=0) or (ves<0)                                   

       then                                                                  

       begin                                                                 

       writeln('Данные введены неверно, повторите ввод');                    

       goto M2;                                                              

       end;                                                                  

{$I-}                                                                        

M33:Write('Введите цену блюда: ');                                           

Readln(cena);                                                                

if(ioresult<>0 ) or (cena<0)                                                 

  then                                                                       

  begin                                                                      

  writeln('Данные введены неверно, повторите ввод');                         

  goto M33;                                                                  

  end;                                                                       

{$i+}                                                                        

    Skid:=cena-cena*0.1;                                                     

Writeln('Цена со скидкой: ',Skid:9:2);                                       

Writeln;                                                                     

end;                                                                         

end;                                                                         

                                                                             

                                                                             

procedure Zapis;                                                             

begin                                                                        

if n=0 then                                                                  

begin                                                                        

Writeln('Список пуст!');                                                     

exit;                                                                        

end;                                                                         

Write('Введите имя файла ');                                                 

Readln(f_n);                                                                 

Assign(f,f_n);                                                               

Rewrite(f);                                                                  

for i:=1 to n do                                                             

Write(f,M[i]);                                                               

Close(f);                                                                    

Close(f);                                                                    

Writeln('Запись завершена');                                                 

end;                                                                         

                                                                             

procedure Vivod;                                                             

begin                                                                        

ClrScr;                                                                      

writeln('╔════════════════════════════════════════════════════════╗');

writeln('║                                МЕНЮ                                                                                                                                  ║');

writeln('╠═══╦════════════════╦══════╦════════════╦══════════════╣');

writeln('║ №   ║   Название блюда               ║   Вес             ║  Цена(руб.)              ║ Цена со скидкой            ║');

writeln('║        ║                                                 ║                     ║                                    ║   10% (руб.)                     ║');

writeln('╠═══╬════════════════╬═══════╬════════════╬══════════════╣');

for i:=1 to n do                                                            

begin                                                                        

writeln('║',i:3,'║',     M[i].nazv:19,'               ║',M[i].Ves:10,'║',M[i].Cena:12:2,'    ║',M[i].skid:17:2                  ║’);

  end;                                                                       

writeln('╚═══╩═══════════════╩══════════╩════════════╩════════════╝');

                                                                             

end;                                                                         

procedure Chtenie;                                                           

begin                                                                        

Write('Введите имя файла');                                                  

Readln(f_n);                                                                 

Assign(f,f_n);                                                               

{$I-}                                                                        

Reset(f);                                                                   

{$I+}                                                                        

if IOResult<>0then                                                           

begin                                                                        

writeln('Указанный файл не  найден!');                                        

exit;                                                                        

end;                                                                         

n:=0;                                                                        

while not(Eof(f))do                                                          

begin                                                                        

inc(n);                                                                      

Read(f,M[n]);                                                                

end;                                                                         

Close(f);                                                                    

Writeln('Ввод окончен');                                                     

end;                                                                         

                                                                             

                                                                             

Procedure Dopolnenie ; {процедура дополнения таблицы данными}                

label M5,M6,M8;                                                              

Begin                                                                        

ClrScr;                                                                      

if(n=0) then                                                                 

  begin                                                                      

  writeln('Cписок   не содержит записей, для корректной  работы выполните ввод')

  writeln('        Нажмите Enter  для перехода в  меню');                     

  exit;                                                                      

  end                                                                        

       else                                                                  

       begin                                                                 

writeln('╔════════════════════════════════════════════════════════╗');

writeln('║                                МЕНЮ                                                                                                                                 ║');

writeln('╠═══╦════════════════╦══════╦════════════╦══════════════╣');

writeln('║ №   ║   Название блюда                ║   Вес         ║  Цена(руб.)             ║ Цена со скидкой                ║');

writeln('║        ║                                                    ║                     ║                                    ║   10% (руб.)                      ║');

writeln('╠═══╬════════════════╬═══════╬════════════╬══════════════╣');

for i:=1 to n do                                                            

begin                                                                        

writeln('║',i:3,'║',     M[i].nazv:19,'               ║',M[i].Ves:10,'║',M[i].Cena:12:2,'    ║',M[i].skid:17:2                   ║’);

  end;                                                                       

writeln('╚═══╩═══════════════╩══════════╩════════════╩════════════╝');

end;

                                                                             

 

                                                                             

{$i-}                                                                        

M8:Write('Укажите  № блюда, после которого будет  добавлена новая запись: ');  

textcolor(white);                                                            

Readln(n1);                                                                  

if ioresult<>0                                                               

   then                                                                      

   begin                                                                     

   writeln('Данные  введены неверно, повторите ввод');                        

   goto M8;                                                                  

   end;                                                                      

{$i+}                                                                        

if(n1>n) or(n1<0)                                                            

        then begin                                                           

             writeln('    Ошибка при указании номера записи’);

             goto M8;                                                        

             end                                                             

             end                                                             

        else                                                                 

         begin                                                               

          n:= n+1;                                                           

          With Elem1 do {обращение к первой записи  массива M1}               

           begin                                                             

            Write (' Введите название блюда: ');                             

Информация о работе Разработка программы обработки массива данных с построением диаграммы (предметная область-«Меню»)