,
() .
?
-,
. "
", (),
. ,
. . ,
- , .
-,
, .
,
.
,
(
, ).
,
, (
) , ,
.
,
, .
.
,
,
. ,
- ,
.
,
(bas, , , pas), .
. QBasic
CHAIN. Turbo (Borland C++)
,
. Turbo Pascal
, unit
Uses.
() Turbo
obj.
,
. tlib.exe
lib.
.
,
unit,
tpu ( Turbo Pascal Unit) ,
.
(, )
. ,
, ,
-
ovl.
.
QBasic .
,
, .
,
.
.
, "FN",
:
DEF FNs1s2...[()]
, ,
:
FNs1s2.
. . =
END DEF.
EXIT DBF,
.
, ,
, END DEF :
DEF FNs1s2.
. . [()]=
, .
, , , . . ,
.
.
.
,
:
DEF FNd=SQR((X1-X2)^2+(Y1-Y2)^2+(Z1-Z2)^2)
37
3 .
. - ,
.
:
FUNCTION _[()][STATIC]
STATIC
,
.
, STATIC
:
STATIC Q1 AS
INTEGER, F AS DOUBLE
,
, :
_
=
,
.
END FUNCTION.
EXIT FUNCTION.
,
(% , & , ! , #
, $ -). ,
.
.
, ,
, GOSUB.
RETURN,
, GOSUB.
,
.
.
.
:
SUB -[()][STATIC]
END SUB.
EXIT SUB.
,
:
_
[ ]
CALL _[(
)]
.
void,
( , ).
,
. ,
. , ,
"void *"
:
void _([])
_([])
* _([])
,
, .
, return
. :
int sign(int
x)
{
/*
*/
if(x<0) return
-1;
if(x>0) return
1;
return 0; }
, ,
. cirscr ().
main,
, .
:
void main(void)
-
, :
_(
);
,
,
:
int qq;
qq=getch();
/* */
, getch
, .
. ,
. , ,
:
sin(0.5);
, .
. getch
,
- .
, ,
:
procedure _[()];
.
(label), (const), (type),
(var) , .
, .
begin
end, , ,
, .
end
.
, ,
. , ,
. ,
,
.
.
.
,
. ,
, ( )
forward. (forward
, ):
procedure _[()];
forward;
,
.
.
,
function .
function _[()]:;
:
_:=;
exit.
,
.
:
program _;
begin,
,
end .
,
:
Unit _;
,
, ,
MS-DOS. ,
(, compile Make Build)
Turbo Pascal
. ,
.
,
, interface, implementation
begin. , interface,
, , ,
, .
implementation ,
. , ,
, . , ,
,
.
. (implementation)
begin,
. ,
. ,
end .
. , ,
,
:
Unit Calendar
interface type
Days=(Mon,Tue,Wed,Thu,Fri,Sat,Sun);
WorkingDays=Mon..Fri;
Months=(Jan,Feb,Mar,Apr,May,June,
July,Aug,Sept,Oct,Nov,Decem);
Summer=June..Aug;
Autumn=Sep..
Nov;
Spring=Mar..May;
DayNo=l..31;
YearNo=1900..2119;
Date=record
Day:DayNo;
Month:Months;
Year:YearNo;
end;
implementation
end.
,
, -
, . .
, ,
. QBasic
(), . ,
, ,
. ,
. . ,
.
.
, .
,
,
.
, . ,
-,
() .
,
, .
, .
,
.
,
,
.
,
.
,
.
,
. , ,
. . ,
. ,
,
.
?
.
(% , & ,
! , # - , $ ),
AS type.
INTEGER, LONG, SINGLE, DOUBLE
STRING.
, , ,
.
,
, LBOUND UBOUND.
(
),
.
, LBOUND(A, 1) LBOUND () .
, . ,
,
.
,
.
, .
, QBasic ,
,
. , QBasic ,
.
, Turbo , Turbo
Pascal,
. -
, .
, , ,
, var.
. ,
,
const.
,
( ).
QBasic
,
, SHARED ( - "
"):
DIM SHARED A(20)
AS INTEGER, D
AS SINGLE
COMMON
SHARED A(20)
AS INTEGER, D
AS SINGLE
, ( )
, -, CHAIN.
, ,
- .
,
.
,
. , ,
extern ():
extern int a[20];
extern float d;
.
, ,
uses.
.
XX . "15",
. 4x4
15 1, 2, ..., 15.
. ,
$100000,
14 15 . ,
.
.
,
, .
,
. ( )
.
(
, ).
2x3, , , , I, S. BASIC:
,
BASIC.
, .
"*".
:
,
,
. 6!=720,
.
, BASIC*
359 .
tree,
360 , ind[360],
.
tree ind (.
6.1):
6.1. tree ind
|
|
|
||
0 |
BASIC* |
-1 |
||
1 |
BAIC*S |
0 |
||
2 |
BASI*C |
0 |
||
3 |
B*AICS |
1 |
||
4 |
B*SIAC |
2 |
||
5 |
BASIC |
2 |
||
6 |
BCAI*S |
3 |
||
,
. ,
. ,
BASIC*.
k- ,
:
, ,
( 1).
1 ()
:
i- j-ro ,
(i-l, j), (i+1, j), (i, j-1),
(i, j + 1). , ,
. , change
. ,
.
2 ()
, 2x3,
. ,
. k
(i,j) :
k =
i * 3 + j. i = k div 3. j = k mod 3.
, ,
0, , .
1.
k.
3 ()
:
6_01.bas
DECLARE SUB
change (il AS INTEGER, j1 AS INTEGER)
DECLARE SUB
printTAB (s AS STRING)
DECLARE SUB
level ()
DECLARE SUB
poisk ()
REM
BASIC
DEFINT A-Z
DIM SHARED x0
AS INTEGER, y0 AS INTEGER, nmax AS INTEGER, k AS INTEGER
DIM SHARED from
AS INTEGER
DIM SHARED tree(360)
AS STRING * 6, ind(360) AS INTEGER, pos0 AS STRING * 6
nmax = 1: x0
= 1: y0 -= 2
tree(0) = "BASIC*"
ind(0) = -1
CLS
INPUT "
- ", pos0
FOR from = 0
TO nmax - 1:
level NEXT from
poisk END
SUB change (il
AS INTEGER, jl AS INTEGER)
DIM n AS INTEGER,
kl AS INTEGER, tmp AS STRING, str2 AS STRING
IF (il <
0) OR (il > 1) OR (jl < 0) OR (jl > 2) THEN EXIT SUB
kl = il * 3
+ jl + 1
str2 = tree(from)
tmp = MID$(str2,
k, 1)
MID$(str2, k,
1) =MID$(str2, kl, 1)
MID$(str2, kl,
1) = tmp
FOR n = 0 TO
nmax - 1
IF str2 = tree(n)
THEN EXIT SUB
NEXT n
ind(nmax) =
from
tree(nmax) =
str2
nmax = nmax
+ 1 END SUB
SUB level
FOR k = 1 TO
6
IF MID$(tree(from),
k, 1) = "*" THEN EXIT FOR
NEXT k
i = (k - 1}
\ 3 '
j = (k - 1)
MOD 3'
CALL change(i
- 1, j)
CALL change(i
+ 1, j )
CALL change(i,
j - 1)
CALL change(i, j + 1)
END SUB
SUB poisk
FOR q = 0 TO
nmax - 1
IF pos0 = tree(q)
THEN GOTO m
NEXT q
PRINT "
"
EXIT SUB
m:
CALL printTAB(tree(q))
q = ind(q)
IF q >= 0 THEN GOTO m
END SUB
SUB printTAB
(s AS STRING)
LOCATE y0, x0:
PRINT "+-+-+-+"
LOCATE y0 + 1, x0: PRINT " | ";
MID$(s, 1, 1);
PRINT "|";
MID$(s, 2, 1);
PRINT "|"; MID$(s, 3, 1); "I" LOCATE y0 + 2, x0:
PRINT "+-+-+-+"
LOCATE y0 + 3, x0: PRINT "|"; MID$(s, 4, 1);
PRINT "|";
MID$(s, 5, 1);
PRINT "|"; MID$(s, 6, 1); " |" LOCATE y0 + 4, x0:
PRINT "+-+-+-+"
x0 = x0 + 10
IF x0 = 81 THEN y0 = y0 + 5: x0 = 1
END SUB
6_01.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void level();
void change(int
il, int J12);
void poisk(};
void print_tab(char*
s);
char tree[360][7];
char pos0[7];
int ind[360];
int i,j,k,nmax=l;
int x0=l,y0=2;
int from;
void main()
{
strcpy(&tree[0][0],"BASIC*");
ind[0]=-l;
clrscr();
printf("
- ");
scanf("%s",pos0);
for(from=0;
from<nmax; from++) level();
poisk () ;
getch ();
}
//---------------------------------
void level()
{
for{k=0; k<6;
k++)
if(tree[from][k]=='*')break;
i=k/3; //
j=k%3; //
change (i-1,j);
change(i+1,j);
change(i,j-1);
change(i,j+1);
}
//-------------------------------------
void change(int
i1, int j1) { char tmp,str2[7];
int n,kl;
if(il<0 ||
i1>l || jl<0 | | jl>2) return;
kl=il*3+jl;
strcpy(str2,
(char*)street from][0]);
tmp=str2[k]; str2[k]=str2[kl]; str2[kl]=tmp;
for(n=0; n<nmax;
n++)
if(strcmp(str2,(char*)&tree[n][0])==0) return;
ind[nmax] =f
rom;
strcpy((char*)stree[n] [0] , str2);
nmax++;
}
//--------------------------------------
void poisk()
{ char *p;
p=Stree[0][0]
;
for(int q=0;
q<nmax; q++)
if(strcmp(pos0,p+q*7)==0)
goto m;
printf("\n
");
return;
m:
print_tab(p+q*7)
;
q=ind[q];
if(q>=0)
goto m;
return;
}
//-------------------------------------------
void print_tab(char*
s) { char top[]= "+-+-+-+";
charmid[]= "+-+-+-+";
char bottom[]="+-+-+-+";
gotoxy(x0,y0);
printf("%s",top);
gotoxy(x0,y0+l)
;
printf("|%c|%c!%c|",s [0],s [1],s [2]);
gotoxy(x0,y0+2);
printf("%s", mid);
gotoxy(x0,y0+3);
printf(";%ci%ci%c!",s[3],s[4],s[5]);
gotoxy(x0,y0+4);
printf("%s",bottom);
x0=x0+10;
if(x0==81){y0=y0+5;x0=l;}
}
6_01.pas
program basic; uses Crt;
var
tree:array [0..359]
of string[6];
pos0:string[6];
ind:array [0..359]
of integer;
x0,y0,i,j,k,nmax,from:integer;
procedure print_tab(s:string);
begin
gotoxy(x0,y0);
write{'+-+-+-+'
);
gotoxy(x0,y0+1);
write {' |',s[l],'|',s[2],'|',s[3],'|');
gotoxy(x0,y0+2);
write('|-+-+-|');
gotoxy(x0,y0+3);
write('!',s[4],'|',s[5],'|',s[6],'|
');
gotoxy(x0,y0+4);
write('+-+-+-+');
x0:=x0+10;
if(x0=81)then begin y0:=y0+5;
x0:=l;
end;
end;
procedure poisk;
var
q:integer;
label m; begin
for q:=0 to
nmax-1 do
if pos0=tree[q]
then goto m;
write('
');
readln;
exit;
m:
print_tab(tree[q]};
q:=ind[q];
if q>=0 then goto m;
end;
procedure change(il,jl:integer);
var
tmp:char;
str2:string[6];
n,kl:integer;
begin
if (i1<0)or
(i1>l)or(j1<0)or(j1>2) then exit;
kl:=il*3+jl+l;
str2 : =tree.[
from] ;
tmp:=str2[k]
;
str2[k]:=str2[kl];
str2[kl]:=tmp;
for n:=0 to
nmax-1 do
if str2=tree[n]
then exit;
ind[nmax]:=from;
tree[nmax]:=str2;
inc(nmax); end;
procedure level;
begin
for k:=l to
6 do
if tree[from]
[k] = '*' then break;
i:=(k-l) div
3; { }
j:=(k-l) mod
3; { }
change(i-1,j};
change(i+1,j);
change(i,j-1);
change(i,j+1);
end;
begin
nmax:=l;
x0:=l; y0:=2;
tree[0]:='BASIC*';
ind[0]:=-1;
clrscr;
write('
');
read(pos0);
for from:=0
to 359 do level;
poisk;
readln;
end.
10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _. 10.11.2021 - 12:36: - Conscience -> . ? - _. 10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _. 10.11.2021 - 12:35: - Ecology -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> . - _. 10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _. 10.11.2021 - 09:18: - New Technologies -> , 5G- - _. 10.11.2021 - 09:18: - Ecology -> - _. 10.11.2021 - 09:16: - Ecology -> - _. 10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _. 10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _. |