1.TEPLOTY
Pole :array [1..40] of integer
Assign(teplot. ´C:/teploty.txt´);
Rewrite(teploty);
For i:=1 to 7 do begin writeln(´zadaj teplotu´,i,´dna´);
Readln( pole[i]);
Writeln(teploty.pole[i]); end; close(teploty);
2.NAHODNE CISLA
Pole... Randomize;
For i:=1 to n do begin Pole[i]:=random(50); end;
Writeln(´cisla ´);
Writeln (pole[i]:4)
For i:=1 to n do begin if pole[i]>max then max:=pole(i);
If pole[i]pole[i] then min:=pole[i];
usporiadanie
Pom:=0
For i:=1 to (n-1) do begin
For j:=1 to (n-i) do begin
If pole(i) > pole[ j+1] then begin pom:= pole[j];
Pole[j]:= pole[j+1];
Pole[j+1]:= pom; end;
6 ,10sustava do dvojkovej
Prevod:string; zadaj cislo (n)
Prevod:=´´;
WHILE n<>0 do begin zvysok := n MOD 2 ;
If zvysok = 0 then prevod:= ´0´+prevod;
If zvysok =1 then prevod :=´1´+prevod; n:= n div2; end; writeln(prevod);


7 hviezdy
1 Pocet hviezd (n); a:=n; x := a-1;
For i:=1 to a do begin
For j:=1 to x do write(´ ´); for k: +1 to a do write (´* ´) ;
Writeln; x: -1;
2 a:=n; x:=a;
For i:=1 to a do begin
For j:=0 to a do write (´ ´);
For k:=j to x do write(´*´);
Writeln; a:= a-1
3 a:=n ; n:=1; for i:=1 to a do begin
For j:=1 to n do write(´ ´);
For k:=n to a do write(´*´); writeln; N:=n+1; end.
8 hviezdy štvorce
1 For i:=1 to n do begin
For j:=1 to n do write(´*´); writeln; end;
2Writeln; for i:=1 to n do write(´*´); writeln;
For j:=2 to n-1 do writeln(´*´,´*´:n-1);
For i:=1 to n do write(´*´); writeln;
3 for i:=1 to 3 do begin
X:=n-1; For i:=1 to n do begin for j:=1 to x do write (´ ´);
For k: +1 to n do write(´* ´); Writeln; x: -1; end; writeln; end; readln; end.
9 VÝŠKA HMOTNOSŤ ŽIAKOV
Type databaza = record
hmotnost:integer; vyska: integer; end; pole:array(1..99) of databaza;
(zadaj pocet ziakov(n) for i :=1 to n do begin (zadaj hmotnost ziaka) readln(pole(i).hmotnost).. vyska
priemH :=0; priemV:=0;
priemH: pole(i).hmotnost) +priemH; priemV: pole(i).vyska)+priemV;
x:=priemH/n; y:=priemV/n; z:=0; min:=pole(i).vyska;
for i:=1 to n do begin if min> pole[i].vyska then min:= pole(i).vyska; z:=z+1;
10 ZAVERECNA PISOMKA
Type databaza= record
Meno:string; body:integer; znamka:integer; pole :array(1..99) of databaza;
Zadaj pocet ziakov(n);
For i:=1 to n do begin writeln(napis meno ziaka); readln(pole(i).meno)..... body aj znamka...
If pole(i).znamka=1 then x: +1...... 2,3,4,5
Writeln( ´Znamka´:10 ,´pocet studentov´:10);
For i:=1 to 5 do begin writeln (pole(i).znamka:10,x:10);....
For i:=1 to n do suc:=pole(i).znamka+suc;
(priemer je :´,suc/n :3:2
11 ATLETIKA
Type ziak =record meno:string; body integer; var pole :array(1..10)of ziak;
zadaj pocet ziakov(n); for i:=1 to n do begin writeln(napis meno ziaka); readln(pole(i).meno)..body
for i:=1 to n do begin if pole(i).body= 10 then x: +1
12 podobne ako atletika 13 podobne
14 TURISTI
Type trasa=record dlzka:integer; narocnost:byte; var t:array(1..99)of trasa
For i:=1 to 5 do begin write(´zadaj dlzku ´,i,´useku´); readln(t(i).dlzka) ...narocnost
X: +(t(i).dlzka) if (t(i).narocnost)=1 then y :=Y+1 .......x- dlzka trasy....y-pocet najlahsich usekov


15 ČÍSLA NAJVACSIE....
Pole:array(1..99)of integer...Randomize .... for i:=1 to n do begin pole(i):=random(50); writeln(pole(i); max... if pole(i) mod 2=0 then y:=y+1 else x: +1
16 pole cisel
17 FYZIKA
program fyzika;
uses crt;
var a:array [1..20] of byte;
i,n,pom,j,nova:byte;
begin
clrscr;
writeln('Zadaj pocet merani: '); readln(n);
for i:=1 to n do begin
writeln('Zadaj ',i,'. hodnotu Fg'); readln(a[i]); end;
for i:=1 to n do write(a[i]:3);
for i:=1 to n-1 do
for j:=1 to n-i do
if a[j] > a[j+1] then begin
pom:=a[j];
a[j]:=a[j+1];
a[j+1]:=pom;
end; writeln;
writeln('Usporiadane hodnoty merania su: ');
for i:=1 to n do write(a[i]:3 ); writeln;
writeln('Zadaj novu hodnotu: '); readln(nova); i:=n;
while (i>0) and (nova0 do begin suc:= x mod 10; y:=y+suc; x: div 10; cif :=cif +1;
If x mod 2 = 0 then (cislo je parne)
Else(cislo je neparne)
21 SMS
Assign(f,´C:/sms.txt´); RESET(f);
WHILE not eof (f) do begin read (f,znak); write(znak); y:=y+1;
If znak=´ . ´ then i:=i+1; CASE znak of ´a´,´e´,´i´,´o´,´u´,´y´:poc:=poc+1; end; end; close(f);
(viet je:´,i) (priemerny pocet samohlasok je:´,poc/i:3:2) (pocet smsiek je:´, y div 50+1) readln; end.
22 MESTA
program Z_22;
uses crt;
var F:text;
A:ARRAY[1..9,1..9] OF longint;
sucNR,sucBA,sucKE,MAX:longint;
I,J,rok:integer;
begin
clrscr;
assign(F,'c:/mesta.txt');
reset(F);
FOR I:=1 TO 3 DO begin FOR J:=1 TO 3 DO begin read(f,A[i,J]); write(A[i,J]:7); end; writeln ; end;
FOR I:=1 TO 3 do begin
sucBA:=sucBA+a[i,1];
sucNR:=sucNR+a[i,2];
sucKE:=sucKE+a[i,3];
end;
writeln;
writeln('BA:',sucBA,' NR: ',sucNR,' KE: ',sucKe);
writeln('BA:',sucBA/3:7:2,' NR: ',sucNR/3:7:2,' KE: ',sucKe/3:7:2);
MAX:=A[1,2];
FOR I:=1 TO 3 DO
IF A[i,2]>MAX then begin
MAX:=A[i,2];
rok:=I;
end;
writeln;
writeln('Najviac obyvatelov v NR bolo v roku 200',i,' s poctom obyvatelov: ',MA ; close(F);readln; end.
Uses Crt Type Obyv = Record
P2003 : LongInt;
P2004 : LongInt;
P2005 : LongInt End;
Var F:Text;
Riadok:String;
code,i:integer;
Max,R,Suma2003,Suma2004,Suma2005 ongInt;
PB,PN,PK:Real; Mesto:Array[1..3] Of Obyv;
S:Array[1..3] Of Longint;
Begin
ClrScr;{a}
Assign(F,'mesta.txt');
Reset(F);
For i:=1 To 3 Do Begin
ReadLn(F,Riadok);
Val(Riadok,Mesto[i].P2003,Code);
WriteLn(Mesto[i].P2003:6);
ReadLn(F,Riadok);
Val(Riadok,Mesto[i].P2004,Code);
WriteLn(Mesto[i].P2004:6);
ReadLn(F,Riadok);
Val(Riadok,Mesto[i].P2005,Code);
WriteLn(Mesto[i].P2005:6);
S[i]:=Mesto[i].P2003+Mesto[i].P2004+Mesto[i].P2005;
End;
Suma2003:=0;Suma2004:=0;Suma2005:=0;
For i:=1 To 3 Do Begin
Suma2003:=Suma2003 + Mesto[i].P2003;
Suma2004:=Suma2004 + Mesto[i].P2004;
Suma2005:=Suma2005 + Mesto[i].P2005;
End;
Writeln;
WriteLn('Pocet obyvatelov za rok 2003 ',Suma2003);
WriteLn('Pocet obyvatelov za rok 2004 ',Suma2004);
WriteLn('Pocet obyvatelov za rok 2005 ',Suma2005);
Writeln;
{b}
For i:=1 To 3 Do WriteLn('Priemerny pocet obyvatelov v ',i,'. meste: ',S[i]/3:10:1);
{c}
Max:=Mesto[3].P2003; R:=2003;
If Mesto[3].P2004>Max Then Begin Max:=Mesto[3].P2004;R:=2004;End;
If Mesto[3].P2005>Max Then Begin Max:=Mesto[3].P2005;R:=2005;End;
WriteLn;
WriteLn('Mesto Nitra malo max.pocet obyvatelov ',Max,' v roku ',R);
ReadLn; End.
23 TEXT
Assign, reset WHILE not eof(f) do begin
WHILE not eoln(f) do begin read(f,x); write(x); if x=´ .´ then y:=y+1; end; readln(f) end;
24 NULA
Programz_24; Uses Crt;
Var F,G:Text;
Riadok:String;
P0,code,i:integer;
Vypisat:Boolean;
Begin ClrScr; Assign(F,'cisla.txt'); Reset(F); Assign(G,'konci0.txt');
Rewrite(G); P0:=0; While Not Eof(F) Do Begin
Vypisat:=True;
ReadLn(F,Riadok);
For i:=1 To Length(Riadok) Do If Riadok[i]='0' Then Begin
Inc(P0);
Vypisat:=False;
End;
If Vypisat Then WriteLn(Riadok);
If Riadok[Length(Riadok)] = '0' Then WriteLn(G,Riadok);
End;
WriteLn; WriteLn(P0); Close(G); Close(F); ReadLn; End.
27 velke pismena
Ret,vysl: string;
(zadaj retazec); (ret); for i:=1 to length(ret) do begin vysl(i):=upcase(ret(i); write(vysl(i); end; readln; end.
Je daná sieť náhodných èísel. Vytvorte program, ktorý
a.) vypíše čísla siete v tvare tabuľky
b.) zistí najväèší a najmenší prvok siete
c.) zistí počet párnych a nepárnych čísel siete
Program Z_2;
Uses Crt; const p=10;
var i,j,m,n,b,max,min,parne,neparne:byte;
a:array[1..p,1..p] of byte;
Begin clrscr;{a} Randomize; writeln ('Zadaj velkost siete (pocet riadkov a stlpcov) ;
readln(m); readln(n);
for I:= 1 to m do begin for j:= 1 to n do a[i,j]:=random(9); end;
{b} max:=a[i,j]; min:=a[i,j];
for I:= 1 to m do begin for j:= 1 to n do if a[i,j]>max then max:=a[i,j];
if a[i,j]

 Blog
Komentuj
Napíš svoj komentár