- •Санкт-Петербургский государственный
- •2.2 Пример решения.
- •3. Формальная постановка задачи.
- •4. Спецификация программы.
- •4.1 Исходные данные.
- •4.2 Функции программы по обработке исключительных ситуаций.
- •4.3 Выходные данные.
- •4.4 Сценарий диалога.
- •5 Разработка структур данных и алгоритмов.
- •6. Текст программы.
- •6.1 МодульInfo.
- •6.2 Модуль lLisTt
- •6.3 Модуль Service.
- •6.4 Модуль Kur
- •6.5 Программа.
- •7. Испытание программы.
- •8. Анализ результатов.
6.5 Программа.
Uses Crt, Kur, Service;
procedureMenu; {основная процедура – отображение меню}
var
X,Y,E,I,State:Integer;
Exit:Boolean;
begin
Exit:=false;
State:=1;
While not(Exit) do
begin
clrscr;
For I:=1 to 7 do
begin
Y:=I+5;
X:=10;
gotoXY(X,Y);
If I=State then
begin
Textbackground(blue);
Textcolor(white);
If I=1 then
write('1) Make Task1.');
If I=2 then
write('2) Make Task2.');
If I=3 then
write('3) Write input file.');
If I=4 then
write('4) Read input file.');
If I=5 then
write('5) Read output file of task1.');
If I=6 then
write('6) Read output file of task2.');
If I=7 then
write('7) Exit.')
end
else
begin
Textbackground(black);
Textcolor(white);
If I=1 then
write('1) Make Task1.');
If I=2 then
write('2) Make Task2.');
If I=3 then
write('3) Write input file.');
If I=4 then
write('4) Read input file.');
If I=5 then
write('5) Read output file of task1.');
If I=6 then
write('6) Read output file of task2.');
If I=7 then
write('7) Exit.')
end
end;
Textbackground(black);
Textcolor(white);
E:=ord(readkey);
If E=0 then
begin
E:=ord(readkey);
If E=72 then
If State=1 then
State:=7
else State:=State-1
Else
If E=80 then
If State=7 then
State:=1
else State:=State+1
end
else
If E=13 then
begin
case State of
1: begin
Task1
end;
2: begin
Task2
end;
3: begin
WriteFin('aaa.txt')
end;
4: begin
ReadFout('aaa.txt')
end;
5: begin
ReadFout('res.txt')
end;
6: begin
ReadFout('res2.txt')
end;
7: begin
Exit:=true
end;
end
end
end
end;
begin
Menu
end.
7. Испытание программы.
Далее приводятся варианты входных и выходных данных для некоторых принципиальных тестов.
1)
Вход «»
Выход1 «»
Выход2 «»
2)
Вход « :%;»№»
Выход1 «»
Выход2 «»
3)
Вход «abc%$#acbabcbac
abcbcaabc*(&-cba
abccab^^%abc»
Выход1 « abc6
acb 1
bac 1
bca 1
cba 1
cab 1»
Выход2 «abc
acb
bca
cba»
4)
Вход «а ааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааааа а»
Выход1 «»
Выход2 «»