OKTÁVA
program cmiter;
uses crt;
procedure krizik(x,y:shortint);
begin
gotoxy(x+1,y);
write('x');
gotoxy(x,y+1);
write('xxx');
gotoxy(x+1,y+2);
write('x');
gotoxy(x+1,y+3);
write('x');
end;
begin
krizik(1,1);
krizik(78,1);
krizik(1,22);
krizik(78,22);
krizik(39,11);
readln
end.
program hviezdickove_obdlzniky;
var a,b,i,j,c:shortint;
procedure fullrec(a,b:shortint);
begin
for i:=1 to b do
begin
for j:=1 to a do write('*');
writeln;
end;
end;
procedure emptyrec(a,b:shortint);
begin
for i:=1 to b do
begin
if (i=1) or (i=b) then
begin
for j:=1 to a do write('*');
writeln;
end
else
begin
write('*');
for j:=1 to (a-2) do write(' ');
write('*');
writeln
end
end
end;
begin
writeln('zadaj rozmery hviezdickoveho obdlznika');
readln(a,b);
writeln('pre plny obdlznik stlac "1" a pre prazdny stlac "2"');
readln(c);
case c of
1:fullrec(a,b);
2:emptyrec(a,b);
end;
readln
end.
program kombinacne_cislo;
program vyraz;
program odmocnina;
uses crt;
var a,n:integer;
v:real;
begin
textbackground(white);
clrscr;
textcolor(black);
writeln('tento program urobi n-tu odmocninu z a');
write('zadaj a: ');
readln(a);
write('zadaj n: ');
readln(n);
v:=exp(1/n*ln(a));
writeln('vysledok: ',v:5:2);
readln
end.
program cosinus;
uses crt;
var x:real;
i:byte;
begin
textbackground(white);
clrscr;
textcolor(blue);
write(' x');
writeln(' cos x');
textcolor(black);
x:=-1;
for i:=1 to 11 do
begin
write(x:5:1);
writeln(cos(x):7:2);
x:=x+0.2;
end;
readln
end.
program lowcase;
var f,g:text;
p:byte;
c:char;
begin
assign(f,'text.txt');
assign(g,'text1.txt');
reset(f);
rewrite(g);
repeat
read(f,c);
p:=ord(c);
if (p>=65) and (p<=90) then write(g,chr(p+32))
else write(g,c);
until eof(f);
close(f);
close(g);
end.
program pocet_priezvisk;
var f:text;
p,q:string;
c:byte;
begin
write('zadaj priezvisko: ');
readln(p);
assign(f,'priezviska.txt');
reset(f);
c:=0;
while not eof(f) do
begin
readln(f,q);
if p=q then c:=c+1;
end;
close(f);
writeln('priezvisko sa v subore nachadza ',c,'-krat');
readln
end.
program higher_numbers;
var f,g:text;
a,n:shortint;
begin
writeln('ake cislo mam priratavat ku cislam?');
readln(n);
assign(f,'cisla.txt');
assign(g,'cishi.txt');
reset(f);
rewrite(g);
while not eof(f) do
begin
read(f,a);
write(g,(a+n),' ');
write((a+n),' ')
end;
close(g);
close(f);
readln
end.
program spaceless;
var f,g:text;
a:char;
begin
assign(f,'maco.txt');
assign(g,'maco_spaceless.txt');
reset(f);
rewrite(g);
while not eof(f) do
begin
read(f,a);
if a<>' ' then
begin
write(g,a);
write(a)
end
end;
close(g);
close(f);
readln
end.
program upcase;
var f,g:text;
a:char;
begin
assign(f,'maco.txt');
assign(g,'maco_upcase.txt');
reset(f);
rewrite(g);
while not eof(f) do
begin
read(f,a);
write(g,upcase(a));
write(upcase(a));
end;
close(g);
close(f);
readln
end.
program file_to_file_twice;
var f,g:text;
a:string;
begin
assign(f,'maco.txt');
assign(g,'novsi.txt');
reset(f);
rewrite(g);
while not eof(f) do
begin
readln(f,a);
writeln(g,a,a:40);
end;
close(g);
close(f);
readln
end.
program file_to_file;
var f,g:text;
a:string;
begin
assign(f,'maco.txt');
assign(g,'novy.txt');
reset(f);
rewrite(g);
while not eof(f) do
begin
readln(f,a);
writeln(g,a);
end;
close(g);
close(f);
readln
end.
program file_to_scr;
var f:text;
a:char;
begin
assign(f,'maco.txt');
reset(f);
while not eof(f) do
begin
read(f,a);
write(a);
end;
close(f);
readln
end.
program polia10;
var a:array[1..20] of byte;
n,i,p:byte;
begin
writeln('kolko chces cisel?');
readln(n);
randomize;
p:=0;
for i:=1 to n do
begin
a[i]:=random(30)+1;
write(a[i]:5);
if (a[i]>20) and (a[i] mod 2=0) then p:=p+1;
end;
writeln;
write('pocet cisel, ktore su parne a vacsie ako 20 je ',p);
readln;
end.
program polia11;
var a:array[1..20] of byte;
n,i,p,q,r:byte;
begin
writeln('kolko chces cisel?');
readln(n);
randomize;
a[1]:=random(30)+1;
p:=a[1];
write(a[1]:5);
for i:=2 to n do
begin
a[i]:=random(30)+1;
write(a[i]:5);
if a[i]>p then
begin
p:=a[i];
q:=i;
end;
end;
r:=a[n];
a[n]:=p;
a[q]:=r;
writeln;
writeln('najvacsie cislo som vymenil s poslednym:');
for i:=1 to n do write(a[i]:5);
readln;
end.