PawelG: Różnice pomiędzy wersjami
| Linia 4: | Linia 4: | ||
<math>  | <math>  | ||
| − |    \begin{  | + |    \begin{tabular}{l}    | 
123\=456\=789\=012\=345\=678\=901\=\kill     | 123\=456\=789\=012\=345\=678\=901\=\kill     | ||
\textbf{program} PawelG;\ \ (* autor Paweł Gburzyński, 1983, \cite{Zabo83}\ \ *)   \+ \\  | \textbf{program} PawelG;\ \ (* autor Paweł Gburzyński, 1983, \cite{Zabo83}\ \ *)   \+ \\  | ||
| Linia 42: | Linia 42: | ||
    writeln(''Bywaj``) \- \\  |     writeln(''Bywaj``) \- \\  | ||
\textbf{end} PawelG \\      | \textbf{end} PawelG \\      | ||
| − | \end{  | + | \end{tabular}     | 
</math>  | </math>  | ||
Wersja z 10:41, 16 mar 2020
Poniżej znajdziesz niewielki program.
- Czy potrafisz odgadnąc co ten program robi i sformułować odpowiednie twierdzenie?
 - Czy potrafisz je udowodnić?
 
[math] \begin{tabular}{l} 123\=456\=789\=012\=345\=678\=901\=\kill \textbf{program} PawelG;\ \ (* autor Paweł Gburzyński, 1983, \cite{Zabo83}\ \ *) \+ \\ var A: arrayof integer; \\ % const l=1, u=8; (* \textit{te liczby mozesz zmienic} *)\\ var n, k, j, licz: integer ; \smallskip \\ unit DrukujA: \textbf{procedure}; \+ \\ var j: integer\- \\ \textbf{begin} \+ \\ \textbf{for} j:=1 \textbf{to} n \textbf{do} write( A(j)) \textbf{od}; \\ writeln \- \\ \textbf{end} DrukujA; \bigskip \\ \\ \textbf{unit} F: \textbf{procedure};\+ \\ var i: integer; \- \\ \textbf{begin} \+ \\ \textbf{if} k=n+1 \textbf{then} \+ \\ \textbf{call} DrukujA; \ licz := licz+1 \- \\ \textbf{else} \+ \\ \textbf{for} i:= 1 \textbf{to} n \\ \textbf{do} \+ \\ \textbf{if} A[i]=0 \textbf{then} \+ \\ A[i] := k; k := k+1; \\ \textbf{call} F; \\ k := k-1; A[i]:=0 \- \\ \textbf{fi}; \- \\ \textbf{od}; \- \\ \textbf{fi};\ \ \textbf{return}\- \\ \textbf{end} F; \- \medskip \\ \textbf{begin} \+ \\ readln(n); \\ array A dim(1:n); \quad \\ % l:=lower(A); u:=upper(A); (* Tu l=1 oraz u=n *)\\ \textbf{for} j := 1 \textbf{to} n \textbf{do} A[j] := 0 \textbf{od}; \\ k :=1;\ \ licz:=0; \\ \textbf{call} F; \\ writeln(''Bywaj``) \- \\ \textbf{end} PawelG \\ \end{tabular} [/math]