Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Untitled;
- {Program wczytuje napis.
- Funkcja:
- f1(napis)
- sprawdza czy w napis jest w formacie
- LLLL-CCCC
- zwraca true - OK
- false - zły format}
- var
- napis:string;
- j:integer;
- function f1(napis:string):boolean;
- var
- i:integer;
- begin
- j:=0;
- for i:=1 to 4 do
- begin
- if (napis[i]>='A') and (napis[i]<='Z') then j:=j+1
- else f1:=false
- end;
- if napis[5]='-' then
- begin
- for i:=6 to 9 do
- begin
- if (napis[i]>='0') and (napis[i]<='9') then j:=j+1;
- end;
- end
- else f1:=false;
- if j=8 then f1:=true;
- end;
- begin
- writeln('Podaj napis:');
- readln(napis);
- writeln(f1(napis));
- readln
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement