.


:




:

































 

 

 

 


. 4. .




4. .

 

. b, n (. 5). , i = ai+ bi. , b, .

 

:

program slogen;

{ 2- }

uses crt;

const n = 10;

var

i,sum: integer;

a,b,c: array [ 1.. n ] of integer;

begin

clrscr;

gotoxy(3,1);

write( );

for i:= 1 to n do { i}

begin

gotoxy(1+5*i,2);

readln(a [i])

end;

gotoxy(3,3);

write( b);

for i:= 1 to n do { bi}

begin

gotoxy(1+5*i,4);

readln(b [i])

end;

for i:= 1 to n do c[i]:= a[i] + b[i]; { i}

gotoxy(3,9);

writeln( );

for i:= 1 to n do { i}

begin

gotoxy(1+5*i,10);

write(c[i])

end

end.

a, b, c . i, i 1 n, . clrscr gotoxy (i,k) crt, uses . Clrscr . gotoxy (i,k) i- k- . , i k integer. gotoxy (i,k) . a b: a[1], a[2], a[3], a[4],..., a[10] b[1], b[2], b[3], b[4],..., b[10], 6, 11, 16, 21,..., 51 2 3 . 6, 11, 16, 21,..., 51 10.

 

5. , , s.

 

, . . , , , , . , .

s (. 6) .

 

:

 

program poisk;

{ }

{ }

const n = 10;

var

i,s,r: integer;

a: array [ 1.. n ] of integer;

begin

for i:= 1 to n do

{ }

begin

write( ,i,- );

readln(a [i])

end;

write( );

readln(s);

for i:= 1 to n do

begin

if a[i] = s then

begin

r:= r + 1;

writeln( ,r,- ,s,

,i);

end;

end;

if r <> 0

then writeln( ,s, ,r, )

else writeln( ,s, )

end.

 

readln(a[i]) write( ,i, ), . i = 1 :

1 ,

, .

i = 2 :

2 ,

.

 

6. , 10 .

 

min max 2 n, aic max c min (. 7). i , max, max i. i , min, min i. max , min .

 

:

 

program minmax;

{ }

const n = 10;

type

list = 1..n;

var

i: list;

min, max: integer;

a: array [list] of integer;

begin

for i:= 1 to n do

begin

write( ,i, );

readln(a [i])

end;

min:= a[1]; max:= min;

for i:= 2 to n do

begin

if a[i] > max then max:= a[i];

if a[i] < min then min:= a[i];

end;

write ( = , max, = ,min)

end.

 

, list .

 

7. 10 .

 

(. 8) . i i1. 1 , , 1= 0.

 

:

 

program sdvig;

{ }

const n = 10;

type

mass = array [1.. n] of integer; { }

var

i: integer;

x: mass;

begin

for i:= 1 to n do

begin

write( ,i, );

readln(x[i])

end;

for i:= n downto 2 do x[i]:= x[i1]; x[1]:= 0;

writeln();

for i:= 1 to n do write(x[i]:4);

end.

 

, .

 

8. , nd , .

 

, . . 1 k. . 2 nd. k . . nd1 . . . .

(. 9).

2 ; 3, 4, 5 . 6 , . 7 xmin k. xmin , , . 8, 9, 10 . 11 i ( ) . 12, 13 .

 

:

 

program perestan;

{ }

const nmax = 100;

type

mass = array [1.. nmax] of real;

var

i, j, k, nd: integer;

xmin: real;

x: mass;

begin

read(nd);

for i:= 1 to nd do

begin

write( ,i,

);

readln(x[i])

end;

for i:= 1 to nd 1 do

begin

xmin:= x[i]; k:= i;

for j:= i+1 to nd do

if x[j] < xmin then

begin

xmin:= x[j];

k:= j

end;

x[k]:= x[i];

x[i]:= xmin

end;

for i:= 1 to nd do write(x[i]:8:2)

end.

 

100 . , nd 100. nd . nd 100, .

 

9. , nd , . .

 

. . , , j-1> xj.

 

:

 

program puzirok;

{

}

const nmax = 100;

type

mass = array [1.. nmax] of real;

var

i, j, nd: integer;

y: real;

x: mass;

begin

read(nd);

for i:= 1 to nd do

begin

write( ,i, );

readln(x[i])

end;

for i:= 2 to nd do

begin

for j:= nd downto i do

if x[j 1] > x[j] then

begin

y:= x[j 1];

x[j 1]:= x[j];

x[j]:= y

end;

end;

for i:= 1 to nd do write(x[i]:8:2)

end.

 

i i 1 .

 

10. n- .

 

, . 4 cap. cap i . . num = capi. , , , , ASCII- 176, 177, 178 218 ( ). n i- , , i graph(i) n .

for j:= 1 to n do write (graph(i)).

(. 10) .

i .

cap i .

trunc . , 0.79. 0.79 , 79 . . , 80% .

 

:

 

program grafik;

uses crt;

const

graph: array[1..4] of char =

(#176,#177,#178,#219);

{

}

var

cap:array[1..4] of real; { }

flag: char;

num: real;

i,j,n: integer;

begin

repeat

clrscr; num:= 0;

for i:= 1 to 4 do cap[i]:= 0;

for i:= 1 to 4 do

begin

writeln( ,i, );

readln(cap[i]);

num:= num + cap[i]

end;

for i:= 1 to 4 do cap[i]:= cap[i]/num *100;

clrscr;

writeln( );

writeln( ,num:12:1, .);

for i:= 1 to 4 do

begin

writeln( ,i, ,cap[i]:5:2,%);

n:= trunc(cap[i]*0.79);

for j:= 1 to n do write(graph[i]);

writeln;

writeln

end;

write( n);

flag:= upcase(readkey);

until (flag = N);

end.

 

, repeat... until. , flag N. flag readkey, . . readkey crt, uses-. upcase .

,

num:= 0; for i:= 1 to 4 do cap[i]:= 0;

, write . writeln .

graph array of char,

. 11.

 

. 11





:


: 2016-11-18; !; : 1347 |


:

:

,
==> ...

1875 - | 1714 -


© 2015-2024 lektsii.org - -

: 0.04 .