. .
.
( ) , , , Prolog C, Pascal, Basic.
( ), (+, , *, /, div, mod) .
Visual Prolog , , (X+4), (+(X,4)).
( =) .
, . , . . B=125 div Z+24. B Z. , Z = 25 B 29. B=125 div (Z+24), Z = 1 B 5. , :
1) , ;
2) , , div, mod, ;
3) (+) (), .
: +, 1
*,/ mod, div 2
, + () 3.
Visual Prolog , , . :
<, < =, =, >, > =, < > > <,
= , .
2. /
( 1)
write(arg1, arg2, arg3,..., argN)
. , . arg ( ) .
( 1)
writef (FormatString, arg1, arg2, arg3,..., argN)
.
, . ( ) . ( \n, \t ..) .
writef().
|
|
:
% _.
: % ( ) .
:
- . .
d ;
u ;
x ;
f ;
;
g ;
;
s .
1.( 2)
GOAL
writef("\n writef \n"),
A = "one",
B = 330.12,
C = 4.3333375,
D = "one two three",
writef("A = '%-7' \nB = '%8.1e'\n",A,B), %1
writef("A = '%' \nB = '%8.4e'\n",A,B), %2
writef("C = '%-7.7g' \nD = '%17.7'\n",C,D), %3
writef("C = '%-7.0f' \nD = '%10'\n",C,D), %4
writef("char:%c,decimal:%d,hex:%x,unsigned:%u",97,97,97,-97),nl. %5
, , . , . 1 7 . 2 A B. 3 D 7 . 13, , . 4. 5 . 97 %c a, , 61. -97 4294967295 4294967199. :
writef
A = 'one '
B = ' 3.3E+02'
A = 'one'
B = '3.3012E+02'
C = '4.333338'
D = ' one two'
C = '4 '
D = 'one two three'
char: a, decimal: 97, hex: 61, unsigned: 4294967199
n
( 3)
readint(Var1)
readreal(Var2)
readchar (Var3)
readln (Var4)
. , Var1 , Var2 , Var3 , Var4 .
, ( , , ) enter.
not
, 1, 7 . , zanjat. A " " . :
|
|
zanjat(X,Y):-
persona(X), X=golubeva,
profession(Y)), not(Y= povar).
not(Y= povar) , Y povar. not .
not , . , . , , - . not .
.
. , X, . , , . .
(char), (integer real) (symbol string).
. \ ( ), .
(symbol) (string). , , . symbol string, symbol string . , string, , , symbol.
1.
'a', 'j', '*', '', '', '' | - | |
'\n', '\r', '\t' | , , , | |
21, - 32000, 6543217 3.0, 35.965, 5e29 -3.5e-100 | ||
summa, prof_povar, a, uslovie_polov | ||
"Marry Poppins" " " "Lev Tolstoy" |