.


:




:

































 

 

 

 


.




= f() , . , . . .

4. = sin( +d) .

INPUT A,B,C,D,H

YMAX=-1E-10

for x =A to B step H

=x* sin(c* x +d)

if >YMAX then YMAX =

next x

print YMAX

end

5. (50) .

option base 1

dim X(50)

for i=1 to 50

input X(i)

next i

XMIN =X(1)

for i=2 to 50

if X(i)<XMIN then XMIN=X(i): k= i

next i

print k, XMIN

end

 

.

 

, . READ-DATA. ,

dim C(3)

READ C(0), C(1), C(2),C(3)

DATA 3.,4.86,3E-5,-1.22

. , , .

, . ,

) DIM A(9)

for i=0 to 9

read A(i)

next

DATA 1.,2.,3.,4.,5.

DATA 6.,7.,8.,9.,10.

) DIM(9)

for i=0 to 9

input A(i)

next

. ,

) DIM S(3,2)

for i=0 to 3

for j=0 to 2

read S(i, j)

next j

next i

DATA 1.,2.,3.,4.,5.,6.

DATA 7.,8.,9.,10.,11.,12.

) DIM S(3,2)

for i=0 to 3

for j=0 to2

input S(i, j)

next j

next i

| 1 2 3 |

| 4 5 6 |

| 7 8 9 |

| 10 11 12 |

INPUT

DIM S(3,2)

for i=0 to 3

INPUT S(i,0),S(i,1),S(i,2)

next i

.

PRINT.

( ) .

for i=1 to n

for j=1 to k

PRINT A(i, j)

next j

PRINT

next i

, . :

) , PRINT ;

) PRINT USING.

. .

1. .

- . , , . - , . .

SWAR A,B

, (=: =).

INPUT N

OPTION BASE 1

DIM A(N)

for i=1 to N.

INPUT A(I)

next i

PRINT " "

PRINT " ? "

INPUT K$

if K$="'' then m1

for i=1 to N-1

for j=1+i to N

if A(i)<A(j) then m2

goto m3

m2:

SWAR A(i),A(j)

m3:

next j

next i

goto m4

m1:

for i=1 to N-1

for j=1+1 to N

if A(I)>=A(J) then m5

goto m6

m5:

SWAR A(I),A(J)

m6:

next j

next i

m4:

PRINT " "

for k=1 to N

print A(k);

next k

end

2. .

n- (X i, Y i), i=0,1,n,

(X0,Y0)=(X n, Y n). : N- ; S- ; X i, Y i- .

.

INPUT " N=";N

DIM X(N), Y(N)

Print " (x,) "

for i=1 to N

INPUT X(i), Y(i)

next i

X(0)=X(N): Y(0)=Y(N): S=0

for i=0 to N-1

S=S+(X(i)+X(i+1))*(Y(i)-Y(i+1))

next

S=ABS(S)/2

Print "S="; S

end

3. .

(n, m) i- j- . .

for k=1 to m

SWAR A(i, k), A(j, k)

next k

4. .

(n, m) .

.

for i=1 to n

for j=1 to m

X((i-1)*m+ j)=A(i, j)

next j

next i

5. (N,M).

.

P=A(1,1): k=1: L=1

for i=1 to n

for j=1 to m

if P>=A(i, j) goto m1

P=A(i, j): k= i: L= j

m1:

next j

next i

 

- , , , . , :

) ,

) ,

) , .

, , , (sin, abs, exp . .). , , , . , ( ) , .

GOSUB m1

GOSUB ( )- ; m1- .

RETURN

RETURN , GOSUB

, END. , ^2++0=0

DATA 1.4,5.2,0.77,2.6,4.8,1.1

READ A,B,C

GOSUB m1

READ A,B,C

GOSUB m1

STOP

m1:

D=B*B-4*A*C

IF D<0 THEM PRINT " ": GOTO m3

X1=(-B+SQR(D))/(2*A)

X2=(-B-SQR(D))/(2*A)

PRINT "X1=";"X2=";X2

m3:

RETURN

END

, STOP, , , . . GOSUB.

. , , , . .

 

DATA 2, 4

READ A, B

GOSUB m1

STOP

m1:

X=A: Y=B

GOBUS m2

X=X^2: Y=Y^2

GOBUS m2

X=X+1/A: Y=Y-1/A

m2:

PRINT X,Y

RETURN

END

, RETURN GOSUB. :

2 4

4 16

4,5 15,5

, .

, SUB END SUB. :

SUB [ ]

[ ]

END SUB

" " , 31 , SUB . " " , , . ( 16 ).

CALL. , ADD.

SUB ADD 9(a, b, c, d)

S= a+ b+ c+ d

Print S

END SUB

w=1: x=2: y=0: z=3

CALL ADD(w, x, y, z)

. , , , , , . :

SUB ANNA (A(1),N,K)

' K

' A

', N+1

K=0

for i=0 to N

if A (i)=0 then K=K+1

NEXT i

END SUB

A(1) ANNA . . - N. ANNA :

N=100: DIM X(N)

CALL ANNA (X(),N,L)

PRINT L

END

, Turbo Basic . , , (), .

, Turbo Basic "" , , . , . ; , . ,

cls

option base 1

k=5

dim X(k), y(k)

for i=1 to k

read X(i)

Y(i)= X(i)

next i

data 1, 2, 3, 4, 5

CALL Dammy (X(), k s)

print " "; s

print x(1); x(2); x (3); x (4); x(5)

print y(1); y(2); y (3); y(4); y(5)

end

'

SUB Dammy (X(1), k, s)

LOCAL Y()

dim Y(k)

s=0

for m=1 to k

s= s+ X(m)

Y(m)= X(m)^2

next m

END SUB

15

1 2 3 4 5

1 2 3 4 5

Y Dammy , "" .

, .

, , ,

$ INCUDE

, , , . ,

BAI.BAS ( BASIK)

OPAL.PAS PASCAL

MISHEL.DAT

QBASI, , . , , - .

.

1) GMTRA A N´M c R M´N.

: CALL GMTRA (A(), n1, R(), n1, n, m)

N- R;

M- R;

n1- R(n1=N´M).

:

$ INCLUD "GMTRA.BAS"

option base 1

cls

n=2: m=3

dim A(n, m), R(m, n)

for i=1 to n

for j=1 to m

read A(i, j): next: next

DATA 1, 2, 3, 4, 5, 6

n1=n´m

CALL GMTRA (A(), n1, R(),n1, n, m)

print " "

for i=1 to m

for j=1 to n

print R(i, j);

next j

print

next i

end

1 4

2 5

3 6

2) GMADD

N´M c R N´M

: CALL GMADD (A(), n1, B(), n1, R(), n1)

n1- , R (n1=N´M).

:

$ INCLUDE "GMADD.BAS"

option base 1

cls

n=2: m=3

dim A(n, m), B(n, m), R(n, m)

for i=1 to n

for j=1 to m

read A(i, j): next: next

DATA 1, 2, 3, 4, 5, 6

for i=1 to n

for j=1 to m

read B(i, j): next: next

DATA 0, 1, 0, 1, 0, 1

n1=n*m

CALL GMADD (A(), n1, B(), n1, R(), n1)

print " +=R"

for i=1 to n

for j=1 to m

print R(i, j);

next j

end

+=R

1 3 3

5 5 7

3) GMSUB

N´M c R N´M.

: CALL GMSUB (A(),n1,B(),n1,R(),n1)

n1- , R (n1=N´M)

:

$ INCLUDE "GMSUB.BAS"

option base 1

cls

n=2: m=3

dim A(n, m),B(n, m),R(n, m)

for i=1 to n

for j=1 to m

read A(i, j): next: next

DATA 1, 2, 3, 4, 5, 6

for i=1 to n

for j=1 to m

read B(i, j): next: next

DATA 0, 1, 0, 1, 0, 1

n1=n*m

CALL GMSUB (A(), n1, B(), n1, R(), n1)

print " -=R"

for i=1 to n

for j=1 to m

print R(i, j);

next j

print

next i

end

-=R

1 1 3

3 5

4) PGM2 det (A)

N´M

: CALL PGM (n, A(), n1, D)

:

- ;

n- ;

n1- A(n1-n*n);

D- .

. .

:

$INCLUDE "PGM2. BAS"

option base 1

cls

n=3

dim A(n, n)

for i=1 to n

for j=1 to n

read A(i, j): next: next

DATA 3, 2, 1, 5, 3, 6, 4, 3, 6

n1=n*m

CALL PGM2 (n, A(), n1, D)

print " "; D

end

8,999999046325684

5) GMPRD N´M

M´L R

N´L.

: CALL GMPRD (A(), n1, B(), n2, R(), n3, N, M, L)

:

N- R;

- ;

L- R;

n1- (N*M) ;

n2- (M*L) ;

n3- (N*L) R;

.

$INCLUDE "GMPRD. BAS"

option base 1

cls

n=2: m=3: l=3

dim A(n, m), B(M, l), R(n, l)

for i=1 to n

for j=1 to m

read A(i, j): next: next

DATA 3, 2, 1, 2, 1, 3,4, 3, 0

n1=n*m: n2=m*l: n3=n*l

CALL GMPRD (A(), n1, B(), n2, R(), n3, n, m, 1)

print " ´"

for i=1 to n

for j=1 to l

print R (i, j);

next j

print

next i

end

´

19 13 7

46 31 19

6) MINV

N.

: CALL MINV (n, A(), n1, D)

:

- ;

n- ;

n1- (n1=n*n)

D- .

. .

.

$INCLUDE "MINV. BAS"

option base 1

cls

n=3

dim A(n, n)

for i=1 to n

for j=1 to n

read A(i, j): next: next

DATA 3, 2, -1, 1, 1, 2, 2, 2, 5

n1=n*m

CALL MINV (n, A(), n1, D)

print using " #. #"; D

print

print " "

for i=1 to n

for j=1 to n

print using "###. #", A(i, j)

next j

print

next i

end

1.0

:

1.0 -12.0 5.0

-1.0 17.0 7.0

0.0 2.0 1.0

7) SIMQ

=.

:

CALL SIMQ (n, A(), n1, B(), n)

:

n- ;

- N´N.

n1- (n1=N*N);

B - ( N).

. ; ( ) .

.

$INCLUDE "SIMQ. BAS"

cls

n=3

dim A(n, n), B(n)

for i=1 to n

for j=1 to n

read A(i, j): next: next

DATA 1, 1, 1, 1, 0, -1, 1, 2, 1

For i=1 to n

read B(i): next

DATA 6, -2, 8

N1=n*m

CALL SIMQ (n, A(), n1, B(), n)

print " "

for i=1 to n

print B(i);

next i

end

1 2 3

, = MINV GMPRD:

=-1

|2 4 3| |x1| |1|

| 1 3 2 | |x2| = |4|

|3 5 4| |x3| |1|

$INCLUDE "MINV. BAS"

$INCLUDE "GMPRD. BAS"

option base 1

cls

n=3: m=3: l=1

dim A(n, m), B(m, l), X(n, l)

for i=1 to n

for j=1 to n

read A(i, j): next: next

DATA 2, -4, 3, 1, 3, 2, 3, -5, 4

for i=1 to n

for j=1 to l

read B(i, j): next: next

DATA 1, 4, 1

n1=n*n: n2=m*l:n3=n*l

CALL MINV (n, A(), n1, D)

CALL GMPRD (A(), n1, B(), n2, X(), n3, n, m, l)

print" '

for i=1 to n

for j=1 to l

print using "##. #", X(i, j)





:


: 2016-12-07; !; : 487 |


:

:

.
==> ...

1521 - | 1356 -


© 2015-2024 lektsii.org - -

: 0.19 .