Модуль по работе со списками
unit spisok;
interface
type
PList=^List; {указатель на элемент списка}
List=record
data:integer;
next:PList
end;
TObjList=class
Top,Bottom:PList;
size:integer;
constructor create;
destructor destroy;override;
procedure AddTop(x:integer);
procedure AddBottom(x:integer);
procedure DelTop;
procedure DelBottom;
procedure Print;
end;
implementation
constructor TObjList.create;
begin
Top:=nil;Bottom:=nil;size:=0
end;
destructor TObjList.destroy;
var tmp:PList;
begin
while top<>nil do
begin tmp:=top;
top:=top^.next;
dispose(tmp)
end;
end;
procedure TObjList.print;
var tmp:PList;
begin
if top=nil then writeln(‘spisok pust’)
else begin tmp:=top;
while tmp<>nil do
begin writeln(tmp^.data);
tmp:=tmp^.next;
end;
end;
end;
procedure TObjList.AddTop(x:integer);
var tmp:PList;
begin new(tmp);
tmp^.data:=x;
tmp^.next:=top;
if size=0 then bottom:=tmp;
top:=tmp;
size:=size+1
end;
procedure TObjList.AddBottom(x:integer);
var tmp:PList;
begin new(tmp);tmp^.data:=x;
tmp^.next:=nil;
if size=0 then top:=tmp
else bottom^.next:=tmp;
bottom:=tmp;
size:=size+1
end;
procedure TObjList.delTop;
var tmp:Plist;
begin
if size>0 then
begin
tmp:=top;
top:=top^.next;
size:=size-1;
dispose(tmp);
if size=0 then bottom:=nil
end
else writeln(‘spisok pust’)
end;
procedure TObjList.DelBottom;
var tmp:PList;
begin
if size>0 then
begin
tmp:=top;
while(tmp^.next<>bottom)and(tmp^.next<>nil) do
tmp:=tmp^.next;
if tmp^.next<>nil then
begin
tmp^.next:=nil;
dispose(bottom);
bottom:=tmp
end
else dispose(bottom);
size:=size-1;
if size=0 then
begin
bottom:=nil;top:=nil
end;
end
else writeln(‘spisok pust’)
end; //конец DelBottom
end. //конец unit spisok
- Объектно-ориентированный анализ
- Объектно-ориентированное программирование.
- Объектно-ориентированное проектирование.
- Основные понятия объектно-ориентированного проектирования.
- Классы и объекты в Object Pascal.
- Важнейшие принципы объектно-ориентированного программирования.
- Составляющие класса.
- Объекты
- Создание и уничтожение объектов.
- Наследование конструкторов и деструкторов.
- Свойства и инкапсуляция.
- Статические методы.
- Полиморфизм. Виртуальные и динамические методы.
- Абстрактные методы.
- Перекрытие виртуальных и динамических методов.
- Как устроен объект изнутри
- Перезагрузка методов.
- Задача с использованием полиморфизма
- Области видимости.
- Создание класса комплексных чисел.
- Создание класса векторов
- Объект-список
- Модуль по работе со списками
- Основная программа по работе с объектами-списками
- Система программирования Delphi
- Терминология Delphi.
- Первые шаги визуального программирования в среде Delphi.
- Иерархия компонентов.
- Собственники компонентов
- Элементы управления.
- Компоненты (tComponent)
- Оконные не оконные
- Родительские и дочерние компоненты.
- Объектно-событийное программирование. События
- Реакции на события
- Программирование реакции на событие
- Особенности реализации событий
- Делегирование событий
- Виды событий
- Диалоги. Работа с файлами. Открытие и закрытие файлов с использованием стандартных диалоговых окон.
- TOpenDialog и tSaveDialog – диалоги открытия и сохранения файлов (страница dialogs )
- Компонент класса tform
- Создание и использование форм
- Шаблоны форм
- Программы со многими формами
- Модульный принцип построения программ.
- Программные файлы. Основные типы файлов проекта. Простейшее приложение.
- Структура головного файла проекта.