Advertisement
Guest User

Untitled

a guest
Jan 16th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.72 KB | None | 0 0
  1. program Untitled;
  2. {Program wczytuje napis.
  3.   Funkcja:
  4.   f1(napis)
  5.   sprawdza czy w napis jest w formacie
  6.   LLLL-CCCC
  7.   zwraca true - OK
  8.          false - zły format}
  9. var
  10.    napis:string;
  11.    j:integer;
  12. function f1(napis:string):boolean;
  13. var
  14.    i:integer;
  15. begin
  16.      j:=0;
  17.      for i:=1 to 4 do
  18.      begin
  19.           if (napis[i]>='A') and (napis[i]<='Z') then j:=j+1
  20.           else f1:=false
  21.      end;
  22.      if napis[5]='-' then
  23.      begin
  24.      for i:=6 to 9 do
  25.      begin
  26.           if (napis[i]>='0') and (napis[i]<='9') then j:=j+1;
  27.      end;
  28.      end
  29.      else f1:=false;
  30.      if j=8 then f1:=true;
  31. end;
  32. begin
  33.      writeln('Podaj napis:');
  34.      readln(napis);
  35.      writeln(f1(napis));
  36.      readln
  37. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement