Помогите исправить задачу
В условии сказано: Составьте программу, позволяющую определить, есть ли в школе в 8-х классах однофамильцы. Данные об учениках должны идти в следующем порядке: имя, фамилия, год обучения, буква.
Когда вводишь например фамилию Иванов в 8 класс и в 9 классе, на выходе выдает, что есть однофамильцы... и Например еще когда вводишь Иванов 8 класс и Иванова 8 класс, пишет что нет однофамильцев. Язык программирования Pascal. Помогите исправить задачку, на обработку записей.
В условии сказано: Составьте программу, позволяющую определить, есть ли в школе в 8-х классах однофамильцы. Данные об учениках должны идти в следующем порядке: имя, фамилия, год обучения, буква.
Когда вводишь например фамилию Иванов в 8 класс и в 9 классе, на выходе выдает, что есть однофамильцы... и Например еще когда вводишь Иванов 8 класс и Иванова 8 класс, пишет что нет однофамильцев. Язык программирования Pascal. Помогите исправить задачку, на обработку записей.
Код:
[B][COLOR=black][FONT="]program [/FONT][/COLOR][/B][COLOR=black][FONT="]z[/FONT][/COLOR][COLOR=black][FONT="]6[/FONT][/COLOR][COLOR=black][FONT="];[/FONT][/COLOR]
[COLOR=black][FONT="] [/FONT][/COLOR]
[B][COLOR=black][FONT="]type[/FONT][/COLOR][/B]
[B][COLOR=black][FONT="] [/FONT][/COLOR][/B][COLOR=black][FONT="]cl = [B]record[/B][/FONT][/COLOR]
[B][COLOR=black][FONT="] [/FONT][/COLOR][/B][COLOR=black][FONT="]name: [/FONT][/COLOR][COLOR=blue][FONT="]string[/FONT][/COLOR][COLOR=black][FONT="][[/FONT][/COLOR][COLOR=darkgreen][FONT="]20[/FONT][/COLOR][COLOR=black][FONT="]];[/FONT][/COLOR]
[COLOR=black][FONT="] familia: [/FONT][/COLOR][COLOR=blue][FONT="]string[/FONT][/COLOR][COLOR=black][FONT="][[/FONT][/COLOR][COLOR=darkgreen][FONT="]45[/FONT][/COLOR][COLOR=black][FONT="]];[/FONT][/COLOR]
[COLOR=black][FONT="] year: [/FONT][/COLOR][COLOR=blue][FONT="]integer[/FONT][/COLOR][COLOR=black][FONT="];[/FONT][/COLOR]
[COLOR=black][FONT="] bukva: [/FONT][/COLOR][COLOR=blue][FONT="]string[/FONT][/COLOR][COLOR=black][FONT="];[/FONT][/COLOR]
[COLOR=black][FONT="] [B]end[/B];[/FONT][/COLOR]
[COLOR=black][FONT="] [/FONT][/COLOR]
[B][COLOR=black][FONT="]var[/FONT][/COLOR][/B]
[B][COLOR=black][FONT="] [/FONT][/COLOR][/B][COLOR=black][FONT="]kl: [B]array [/B][[/FONT][/COLOR][COLOR=darkgreen][FONT="]1..100[/FONT][/COLOR][COLOR=black][FONT="]] [B]of [/B]cl;[/FONT][/COLOR]
[COLOR=black][FONT="] [/FONT][/COLOR][COLOR=black][FONT="]i, n, c: [/FONT][/COLOR][COLOR=blue][FONT="]integer[/FONT][/COLOR][COLOR=black][FONT="];[/FONT][/COLOR]
[COLOR=black][FONT="] [/FONT][/COLOR]
[B][COLOR=black][FONT="]begin[/FONT][/COLOR][/B]
[B][COLOR=black][FONT="] [/FONT][/COLOR][/B][COLOR=black][FONT="]Write([/FONT][/COLOR][COLOR=blue][FONT="]'Введите количество учеников= '[/FONT][/COLOR][COLOR=black][FONT="]);[/FONT][/COLOR]
[COLOR=black][FONT="] [/FONT][/COLOR][COLOR=black][FONT="]readln(n);[/FONT][/COLOR]
[COLOR=black][FONT="] [B]for [/B]i := [/FONT][/COLOR][COLOR=darkgreen][FONT="]1 [/FONT][/COLOR][B][COLOR=black][FONT="]to [/FONT][/COLOR][/B][COLOR=black][FONT="]n [B]do[/B][/FONT][/COLOR]
[B][COLOR=black][FONT="] [/FONT][/COLOR][/B][B][COLOR=black][FONT="]begin[/FONT][/COLOR][/B]
[B][COLOR=black][FONT="] [/FONT][/COLOR][/B][COLOR=black][FONT="]writeln([/FONT][/COLOR][COLOR=blue][FONT="]'Введите сведения о '[/FONT][/COLOR][COLOR=black][FONT="], I, [/FONT][/COLOR][COLOR=blue][FONT="]'-м ученике:'[/FONT][/COLOR][COLOR=black][FONT="]);[/FONT][/COLOR]
[COLOR=black][FONT="] [/FONT][/COLOR][COLOR=black][FONT="]write([/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=blue][FONT="]Имя[/FONT][/COLOR][COLOR=blue][FONT="] '[/FONT][/COLOR][COLOR=black][FONT="]);[/FONT][/COLOR]
[COLOR=black][FONT="] readln(kl[I].name);[/FONT][/COLOR]
[COLOR=black][FONT="] write([/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=blue][FONT="]Фамилия[/FONT][/COLOR][COLOR=blue][FONT="] '[/FONT][/COLOR][COLOR=black][FONT="]);[/FONT][/COLOR]
[COLOR=black][FONT="] readln(kl[I].familia);[/FONT][/COLOR]
[COLOR=black][FONT="] write([/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=blue][FONT="]Класс[/FONT][/COLOR][COLOR=blue][FONT="] '[/FONT][/COLOR][COLOR=black][FONT="]);[/FONT][/COLOR]
[COLOR=black][FONT="] readln(kl[I].year);[/FONT][/COLOR]
[COLOR=black][FONT="] write([/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=blue][FONT="]Буква[/FONT][/COLOR][COLOR=blue][FONT="] '[/FONT][/COLOR][COLOR=black][FONT="]);[/FONT][/COLOR]
[COLOR=black][FONT="] readln(kl[I].bukva);[/FONT][/COLOR]
[COLOR=black][FONT="] [B]end[/B];[/FONT][/COLOR]
[COLOR=black][FONT="] writeln; [/FONT][/COLOR]
[COLOR=black][FONT="] c := [/FONT][/COLOR][COLOR=darkgreen][FONT="]0[/FONT][/COLOR][COLOR=black][FONT="];[/FONT][/COLOR]
[COLOR=black][FONT="] [B]for [/B]i := [/FONT][/COLOR][COLOR=darkgreen][FONT="]1 [/FONT][/COLOR][B][COLOR=black][FONT="]to [/FONT][/COLOR][/B][COLOR=black][FONT="]n - [/FONT][/COLOR][COLOR=darkgreen][FONT="]1 [/FONT][/COLOR][B][COLOR=black][FONT="]do [/FONT][/COLOR][/B]
[B][COLOR=black][FONT="] begin[/FONT][/COLOR][/B]
[B][COLOR=black][FONT="] if [/FONT][/COLOR][/B][COLOR=black][FONT="]((kl[I].year = [/FONT][/COLOR][COLOR=darkgreen][FONT="]8[/FONT][/COLOR][COLOR=black][FONT="]) [B]and [/B](kl[I].familia = kl[I + [/FONT][/COLOR][COLOR=darkgreen][FONT="]1[/FONT][/COLOR][COLOR=black][FONT="]].familia)) [B]then [/B]inc(c); [/FONT][/COLOR]
[COLOR=black][FONT="] [B]end[/B];[/FONT][/COLOR]
[COLOR=black][FONT="] [B]if [/B]c >= [/FONT][/COLOR][COLOR=darkgreen][FONT="]1 [/FONT][/COLOR][B][COLOR=black][FONT="]then [/FONT][/COLOR][/B][COLOR=black][FONT="]writeln([/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=blue][FONT="]Однофамильцы[/FONT][/COLOR][COLOR=blue][FONT="] [/FONT][/COLOR][COLOR=blue][FONT="]есть[/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=black][FONT="]) [B]else [/B]write([/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=blue][FONT="]Однофамильцев[/FONT][/COLOR][COLOR=blue][FONT="] [/FONT][/COLOR][COLOR=blue][FONT="]нет[/FONT][/COLOR][COLOR=blue][FONT="]'[/FONT][/COLOR][COLOR=black][FONT="]); [/FONT][/COLOR]
[B][COLOR=black][FONT="]end[/FONT][/COLOR][/B][COLOR=black][FONT="].[/FONT][/COLOR]