Vous êtes sur la page 1sur 194

Boole / _

(....)


http://users.sch.gr/iordanissav
Boole / _


,

/.



,
,
()

/

(.. Pascal, C, Fortran, Java, Visual
Basic ..)
,
,
,
Boole / _


Boole / _


,
,
.

.. , ,
,
..
Boole / _

1.

2.



( , ,
..).
!
Boole / _

1. 2.

3. 4.

5. 6.
Boole / _




1.


2.
()

,
3.
Boole / _


.
,

.


,
()
.
Boole / _



()



1 2 3

1.1 1.2 1.3 3.1 3.2 3.3


Boole / _

:




.
.
.
Boole / _


,

(, , , ).
.. 1562, 24/5/2005,

,
.

,

,
.
Boole / _



Boole / _


()
:


(.. )


,
.


.

Boole / _


()
:

( )



.
Boole / _

/

/ :
1.
2.
3.
4. ...
5. !

, /
, !
Boole / _


:
f(x) = 2x2 3x + 4

=2, =-3, =4


(). = 2 4
< 0 ;
x1,x2 = (- ) / 2


() /

,

Boole / _



Boole / _


,
(),


, ,
(.. )
.

:

825 .., Abu Jafar Mohammed ibn Musa
al Khowarizmi.


( ),
(), ()
Boole / _


:
(input) , .

(output),
( )
.. : .... . ;
, .
()
( )
.. 100 .
, .
,
.


Boole / _



:


;


,





(, , /, )
Boole / _

(free text)

(flow charts)
,
. ,
.

(pseudocode)
(),
,
,
.
Boole / _


()

:
: / 0
1.
2. 0
3. , /

4. ,
Boole / _


()




;


0;



/



,
, ..



Boole / _


()


,
<> 0
/



_

Boole / _

.


(4)



,

.

(3)

.

Boole / _


1. (variables)
,
.
2. (constants)
, ,
(.. : 3,14 : 21%)
3. (operators)

(+, - , * , / , < , > , , , , , ^ , MOD, DIV, ..)
4. (commands)
,


5. / (expressions)

() .
.. + 15 /
+ 15 /
6.

,
. (!)
Boole / _

1.
.
,

.
( _ )
.. , _12, Status , ,
,1, @35
*** ,
(.. ) ***
,
.. , , (/),
(. ) ..
.:
(.. ). .
,
.. 50, 45.23 , ,
.
>>> , . <<<
Boole / _

1.
()

1. ,
Status
Status Status

2. 200,
Y3
Y3 200 Y3 200
3.
3 + 100, , ,
3 100
3 + 100 300
4. 3 1.
3 + 1
3 Y3 201
3
3 3 + 1
Boole / _

2.
, ,
.. 21%
. .

( ).
(=),
.. =3.14
,
(
)
,
,

.
:
Boole / _

2.
()
(21%)
.
, (_ x _)

_ 50.00 x 0.21
_ 60.00 x 0.21
_ 150.00 x 0.21
0.21 3 .
0.23,
3 .
.
:
_ = 0.21
_ 50.00 x _
_ 60.00 x _
_ 150.00 x _
0.23,
,

Boole / _

3.

.

1 10 (1: 10)
+ 1 10 + 20 (1: 30)
- 1 10 20 (1: -10)
* 1 10 * 20 (1: 200)
/ 1 10 / 2 (1: 5)
^ 1 10 ^ 2 (1: 100)
DIV 1 10 DIV 3 (1: 3)
MOD 1 10 MOD 3 (1: 1)
< , <= , 1 (5 < 7) (1: )
> , >= , 1 (5 >= 7) (1: )
= , <> , 1 (5 <> 7) (1: )
( / ) 1 (4 > 3) (6 < 2) (1: )
( / ) 1 (4 > 3) (6 < 2) (1: )
( / ) 1 (4 < 3) (1: )
Boole / _

4.
( )

_
_
1, 2 1, 2

/ 1 , 1, 2
2 / 2
__ = 5
y 10
,
y 20
_ _
__ < 5
+1
_ _
_ _
+1
_ __ _ = 5
1 i 1 10
+5
_ _
Boole / _

4.
()

.
. . :

( ( ) + _ ( ) ) + 50

() (200) = 0.71
() (50) = 0.64
() (45) = 1.73
_() _(16) =4
() (40) = 3.69
() ex (3) = 20.09
_() _(32,6) = 32
_() _(-5) =5
Boole / _


( )
1. :
_
2. .
3. ,
,
(). _
4.
( ), = 3.14
, , _)

5.
* ^ 2
()
6. ( ) E=,
:
1,2... _
7. 2 6
,

8.
_ (
1)
Boole / _


( )

1. :
_
2. :
_
, (=)

3. :
= 3.14
,

4.
: : ,
5. ,
,
().
6. * ^ 2
( )
( , , _) E=,
7. _
()
8. :
1,2...
9.
: _
Boole / _


&

,
,
,
. :

,

.
, //1, 2,...//



,

, _
, _
Boole / _


,

.

3


.
Boole / _

4.
#1


,
()
_

1,2,3 1, 2, 3

MO (1+2+3) /

_
Boole / _

4.
#1 ()


_

_
1, 2, 3 : 1,2,3,
:
1, 2, 3
3
3 1, 2, 3
(1 + 2 + 3) /
(1+2+3) / 3

(1+2+3) /



_
_
Boole / _

4.
#2
(Swap)

8
5 8 5 5 8

1. 1.


2.
3.



Boole / _

4.
#2 ( )


Swap
Swap
x, y : x, y, z
x, y

zx x, y
x y zx
y z xy
zx
yz xy
yz
, y x, y
x, y
Swap
_
Boole / _

BOOLE
Boole / _

BOOLE
( George Boole, . )



, , .

( ,
)
( )
1. ( )

2. ( , )


3. ( , )
Boole / _

BOOLE
( )
() ( = 5) (<>5)
()
( = ) <>

(=5) (=10)
(>5) (<10) 5<<10

(=) (=) =
<>
( = ) ( <> )


(=5) (=10) =5 =10

(>5) (<10)
(=) (=15)
Boole / _

BOOLE
()

(>4) (<) (=) (<)


6 4 -1
5 -2 0
3 3 2
10 10 20

< <= >= <


3 5
9 3
8 8
0 -2
Boole / _


.



4



,

.

3


.
Boole / _

4. ()
/



,
1, 2, 3

3
_ (1+2+3) /

............. >= 10

_
_


Boole / _

4. ()
()




1, 2, 3
: 1,2,3,
:

3
1, 2, 3

(1 + 2 + 3) / 3

(1+2+3) /

>= 10
>= 10




_

_

Boole / _

4. ()

1, 2, 3
_
3

............ (1+2+3) /

>= 10
..............

_

_


Boole / _

4. ()
()




1, 2, 3 : 1,2,3,
:

3 1, 2, 3

3
(1 + 2 + 3) /
(1+2+3) /

>= 10
>= 10



_

_
Boole / _

4. ()


_1_ 1, 2, 3

............... 3
(1+2+3) /
_ _2_

< 10
...............

_ __ _ <= 15

............... _ <= 18


................
_ _


Boole / _

4. ()
()




: 1,2,3,
:
< 10

1, 2, 3

<= 15 3
(1+2+3) /

< 10
<= 18
_ <= 15

_ <= 18



_
_
Boole / _

4. ()





1 < 1
.........
2 < 5
........
3 < 12

........ < 19

........ < 65
_


_

Boole / _

4. ()

1, 2, 3
3
14
_1_ (1+2+3) /
_2_ < 10
< 15



_ _

_3_ < 15



_
_ _
_
Boole / _

4. ()
()



: 1,2,3,,
:
< 10
1, 2, 3
3
14
< 15 < 15
(1+2+3) /
< 10
< 15



_

< 15



_
_
_
Boole / _




,
.

.
Boole / _

4. ( )
( ;)




! ,
. .. :




( )

!

Boole / _

4. ( )
( ;)
1 0 0
2 1 1
3 + 1 1 > 0
4 2 + 1
................ _
+ 2
................ .....................
................ ...................... .....................
................ ...................... 7
15 6 7 > 0
+ 6 + 1
/ 6 _

1 0 0
1 1 3
<= 15

_
2 > 0

+ 1 + 1
+
_ _
+1 _
_ X > 6

/ 6
Boole / _

4. ( )
( ;)


,
1000
,

15 6




Boole / _

4. ( )

:
1. .

( )
2. ( )



, .

.. 10 , ,


,
.
Boole / _

4. ()
( )
3 :
1. (). ..
0
5
0
2. . ..
10,
14:00.

3. . ..
1+2+3+.... + 5+10+15+...+ -5 + ! ( )

F(x) x 1-100
Boole / _

4.

__
x 20
............ x >= 10
_ yy+2*x+5
xx1
: _
__ : ,
(.. >= 10)
,
, .
,
, ...
,
, , .
, ,
( )
.
Boole / _

4.
()

.
(


;
)


Boole / _

4.
#1


1 100

,
,
_1_100
i1
,
( i 1 . 100), i <= 100
i
ii+1
, (i) _
,
,
. _1_100
,

i 101, ,
_
Boole / _

4.
#2




()

,
, S0
.
/ ,
( 0
) SS+
!!! SOS !!!
0 ( _

) S
( SOS)
,
,
.
Boole / _

4.
#3
,
1 100,


. , MinMax
. 0 !!!
, 101 !!!
0
().

<1 >100 >= 1 <= 100
>
<
+ 1
1,
!!!! SOS !!!!
( SOS) _
,
, , ,
. MinMax
Boole / _

4.
#4



A B

45 19 45
,
90 9 90

(
) 180 4
> 0 360 2
1
720 1 720
2
855

Boole / _

4.
#4 / ()

DIV 2 A_
, ,
S0
*2
S 0 > 0
MOD 2 = 1
SS+
S S+
_

>0 MOD 2 = 1 *2
DIV 2
_

S S

A_

Boole / _

4.

_
x 50

............ _
_ __ yy+2*x+5
xx1
: _ x = 0
__ : ,
.
.. _ >= 10 = ..
,
.
,
, , .
, ,
( )
.
, ()
() ( )
Boole / _

4.
()


(

)


Boole / _

4. _
#1


1 100

,
,
_
_1_100
, i1

_

, (i) I
,
ii+1
, . _ i > 100
,

i 101, , _1_100
_
Boole / _

4. _
#2



()

, S0

,
_
.

/ ,
SS+
( _ = 0
)
S
0 (

)
Boole / _

4. _
#3

,
1 100,


. , MinMax
. 0 !!! .
101 !!! .
, 0

(). _

1 - 100
>
<
+ 1
_ < 1 > 100
1,
, ,
( < 1 > 100) MinMax
,
Boole / _

4.

1
x 1 10
............ yy+2*x+5
_ zx1
y, z
: _

1 :

:
: ,
:
( 1, , .
, >= )

1
,
/_, .
, .
, 1. ,
, .
Boole / _

4.
()






(


;
)


Boole / _

4.

1. 10 20 11
2. 10 10 1
3. 30 20
4. A1 10
A2 21
1 2 12
5. -10 10 21
6. -10 -20
Boole / _

4.
#1
1+2+3+....+100

_100
i1
Sum 0 Sum 0
ii+1
Sum Sum + i i 1 100
Sum Sum + i

i <= 100 _


Sum
_100
Sum



Boole / _

4.
#2


1 10

1 2
;
3 3
0 0
i 1 10 _ 2 i 1 10
+ i i MOD 2 = 1
_ + i
_
3 _

3
Boole / _

4.
#3
t 1 100sec 5sec =3m/sec2
s=..t2



3 3
t1 S 1 / 2 * * t^2
t, S t 1 100 _ 5
tt+5

t <= 100
s 1 / 2 * * t^2

t, s



_

_100
Boole / _



,
. ..:

1-100

_ __ _
i1 i1 i 1 100
i <= 100 _ i
i i _
ii+1 ii+1 _
_ _ i > 100
_ __


,

( ), .
.
Boole / _



x 1 100
y 1 100 , .
z 1 100
3*x+2*y-7*z = 5
x, y, z
_
_
_
_ (x, y, z)

100x100x100 !
Boole / _


&

Boole / _


( )

(.. , , , ,
, )
,

,


()

(Information Theory)
,
,
Boole / _


:

,
(.. ASCII,UNICODE, bits, .)

,
,

+
(.. = : , , .,
= , , , )


. (.. B , Data modeling)
Boole / _




.
:






. Niklaus Wirth
( / PASCAL)
1976: + =
Boole / _

&

,
,
.


,

.
, .

,
.
.
Boole / _

1

/:
(1,1) (2,2) ..........(,)


1 . 2536037456
2 2555052368
3 2556053362
4 2525057363 ;
5 2455022318
6 2525072367 ;
7 2575043261
8 2551026367
9 2558092460
Boole / _

2
:
1. ,
/
(1,1) (2,2) ..........(,)
2. ,

(,1) (,2) (,3) (,4).....(,24)


1 2455022318
2 2551026367
1 3 2525072367
4 2558092460
2
5 2575043261
4
6 2556053362
7 7 2555052368
9 8 2525057363
9 . 2536037456
Boole / _



.


, .

,
, .
(..
).

,
.
. .
Boole / _


i [ 7 ]

(.. , , )
[4]
( (1),
(2), ).
j [ 3,7 ]
1.
2 38 24 5 9 53 3
, i 14 7 9 15 8 4 31
,
4 18 8 5 14 35 3
.
(.. [ 3 ], [ 8 ], [ 2, 5 ] ). [3,6]
,
, [ 3,7,3 ]
k
(
). 2 j 58 24 5 9 53 3
2 58 24 5 9 53 3
2 1438 7 24 9 5 15 9 8 53 4 3 31
i 14144 7 748 9 9 8 15155 8 814 4 43531313
4 48 8 5 14 35 3
. , 4 18 8 5 14 35 3
[1,4,3]

Boole / _



,
,
(
):
[ 5 ] 26
[ i ]
_[ 12, 3 ]
[ i ]


:
+ [ i ]
[ i + 4, 43 ]
[ i ] [ i ] + 10
Boole / _

;

.
(.. 10 ,
10 , 10
).


(. / ,
)



(
)
Boole / _


.


,
,
,
,

.
Boole / _




:

/



,

.

Boole / _




( K 10
).
i 1 5
[ i ] K
,
K K + 5

_

i [ 5 ]
[ 1 ] 10
,
2 15
, . 3 20


4 25
5 30
Boole / _


10
: i, [10]
.
i 1 10
TON , i, o
, [ i ]
_

i 10 1 _ -1
[ i ]
_

_
Boole / _

100
.

: i, [100]
. : [100]


i 1 100
[ i ] 0
[ i ]
_
(),
. _

Boole / _


5
, : i, [5], [5]
5,7,14,3,26
[ 1 ] 5
[ 2 ] 7
, [ 3 ] 14
[ 4 ] 3
[ 5 ] 26

i 1 5
[ i ] [ 6 i ]
_
_
Boole / _






: i, [5], [5], [5]

4 2 _
7 9 _ i 1 5
[i][i]+[i]
3 + 3 = _ _
2 4 _
5 6 _ _
A B
Boole / _





: i, [10], _
10 ,
(>0) i 1 10
_
TON , i , o ()
[ i ]
. _ [ i ] > 0
_
, _ 1
i 2 10
[ i ] > [ _ ]
_ i
_
_
= , _
= , [ _ ]
_
Boole / _




,
.
:

( ,
,
)
(
)
( (.. )
)

( ,
)
Boole / _


#1

10
: i, [10],
, :
:

, i 1 10
, [ i ]
_
0

, i 1 10
[ i ] =
:, i
+ 1
_
, _
AN = 0

_
_
Boole / _


#2

,
10 ,
: i, [10],
:
,
, i 1 10
. [ i ]
, _


, i1
(i <= 10) ( )
. [ i ] =
. :, i
,
,
i 10 1 ii+1
i >= 1 _
_
: AN =

OXI = _
_
Boole / _


( ) -
, RAM,
, (
, , , )
,
, ()
, : (), (), (),
.. (), (), () . ()
( ).
, .
, , .
,
.
:
.
Boole / _




()
,
.
;

,
,

. , i=1 62.5 24
,
- 2 80 45
()
, 3 52.3 19
(
) 4 62 24
,
5 77.8 41

, 6 90 59
.
, , 7 58 22

Boole / _


,
.
.
,
.
..: Bubble Sort, Quick Sort, Insertion Sort, Shell Sort,
Selection Sort, ..
,
.
:
, ,
, , .
Boole / _


(. )

__

: i, j, [10]
10 ,
i 1 10
[ i ]
_

i 2 10
j 10 i _ -1
[ j - 1] > [ j ]
temp [ j ]
[ j ] [ j - 1]
[ j - 1] temp
_
_
_
_
Boole / _




,


,

() 2 6.5

8 10.1
temp1 A[ i ] temp2 B[ i ] temp3 [ i ]
A[ i ] A [ i 1] B[ i ] B[ i 1] [ i ] [ i 1] 5 12.4
A[i 1] temp1 B[i 1] temp2 [i 1] temp3

10 5.8
,
.

. ;
Boole / _

.
,
,
,

1.000.000 , 20 !!!
, 500.000
( 1 1.000.000 )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

4 7 11 25 34 37 46 51 57 62 65 68 73 77 80 83

37
?
Left middle Right
Boole / _





i 5 6 j

9 8
,
, 15 9

, 32 18
43

, 51


,
,

Boole / _


(-2)


,
, ..
3
[ 2, 3 ]

1

2 2





Boole / _


2

(m=4 x n=5), .

,
(), // //
. !
, i 1 4
j 1 5
()
[ i , j ]
,
_
_

j =1 2 3 4 5 !
i= 1 j 1 5
i 1 4
2
[ i , j ]
3 _
4 _
[4,5]
Boole / _



300
1 2
,
: i, [300,2], _


(..)
.
1 152 6
_ 1 !
2 253 8
, i 2 300
3 231 11
[ i, 2 ] >[ _, 2 ]
... ... ...
_ i
, ... ... ... _
1 .
_
2 298 63 12
299 82 7 .. :
300 58 10 [ _,1 ]
.. _

Boole / _


#1
__2


: i, j, [4,5], s
4x5

s0
i 1 4
j 1 5
. [ i, j ]
s s + [ i, j ]
_
_

s / (4*5)

_
Boole / _


#2 (. )
_
// m, n, table, col, row //
(m=4 x n=5), sum 0
, i 1 m
( row[i] 0
Excel) _
j 1 n
table[4,5] j col[j] 0
1 2 3 4 5 row[4] _
i 1 m
1 4 5 2 8 5 24 j 1 n
i 2 14 3 7 9 12 45 sum sum + table[i, j]
3 5 7 21 2 15 50 row[ i ] row[ i ] + table[i, j]
col[ j ] col[ j ] + table[i, j]
4 23 12 11 6 3 55 _
= _
col[5] 46 27 41 25 35 = 174 // row, col, sum //
sum _
Boole / _


#1



: i, j, [5,5]
(
) i 1 5
j 1 5
i = j TOTE
[ i, j ] 1
1 0 0 0 0
[ i, j ] 0
0 1 0 0 0 _
0 0 1 0 0 _
0 0 0 1 0 _

0 0 0 0 1 _
Boole / _


#2




: i, j, [3,3], [3,3], [3,3]

3 1 7 3 5 2
i 1 3
9 3 4 + 2 1 6 j 1 3
5 2 8 6 3 4 [ i, j ] [ i, j ] + B[ i, j ]
_ _ _ _
_
_ _ _

_ _ _ _
Boole / _


&
(stack) (queue),

.
, ,

.
, :
, , ,
,
, ,
/ .
,
.
Boole / _


(stack)
,
, [6]
, .
,
(. 6
).
(push) , 5 94
,
( ). 4 52
, 1.
(pop) , 3 84
,
( ).
1. 2 62
,
L.I.F.O. (Last In First Out), . 1 253
, .
Boole / _


: &

_push _pop
//, , , // //, //

< >= 1
+1 [ ]
[ ] - 1
status status

status status
_ _
//, , //, ,
status// status, //
_push _pop
Boole / _


(queue)

()
(front) (rear)
, :
(enqueue) ,
. , rear.
,

(dequeue) ,
. , front
, F.I.F.O. (First In First
Out), . ,
()
1 2 3 4 5 6 7
[7] 72 723 51 100 200

front rear
Boole / _


: &

__ __
//, , rear, // //, front, rear//

rear < front <= rear


rear rear + 1 [ front ]
[ rear ] front front + 1
status status

status status
_ _

//, rear, status// //, front, ,


__ status//
__
Boole / _



front

1 2

12
3
(front)
11

4


(). - 10
5
front
O
9 6
(rear) 7
8
front
rear
Boole / _


: &

__ __
//,,front,rear,// //,,front,rear,CanGet//
(rear mod ) + 1 = front CanGet =
status
status

[front]
rear (rear mod ) + 1 front = rear ! 1
[rear] CanGet
status _
front (front mod ) + 1
_
status
CanGet _
// , rear, status, //,rear,status,
CanGet // , CanGet//
__ __
Boole / _

&

Boole / _

,
/,
( )
hardware / ,
(Von Neumann, 1945)
.
.
,
.
/ ,
, :
(0) (1). , /,
,


/,
Boole / _


1. (1 )
/
,
(1/0)
11111011 01001101
,
01011011 01101000
/ ( hardware
10011000
). 11010111 01101101
, . 01011010
O
11010011 01001101
.........
, ENIAC (1945), .........

,
, .
Boole / _


2. (2 )



INDEX=$01
(assembly language)
(.. ADD), SUM=$02
LDA #10
, STA INDEX
, 1 ,
( CLA
).
LOOP ADD INDEX

DEC INDEX
( - STA SUM
-assembler)
, BRK

Boole / _


3. (3 )

1950,
.


(/)
.
1 1, ,



hardware
/ ().
/ ( / CPU),
.

/
Boole / _


3. (3 )

FORTRAN C PROGRAM EQUATION


READ(*,1) A,B
FORmula TRANslator, 1 FORMAT (F5.1)
, 1957 IF (A.EQ.0) GO TO 20
X=(-1.)*B/A
WRITE (*,2) X
2 FORMAT(X=,F10.2)
GO TO 50
20 IF (B.EQ.0) WRITE(*,3)
IF (B.NE.0) WRITE(*,4)
: 3 FORMAT()
Fortran 77, 90/95, Visual Fortran 4 FORMAT()
50 STOP
END
Boole / _


3. (3 )

IDENTIFICATION DIVISION.
COBOL PROGRAM-ID. EQUATION.
COmmon Business Oriented ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
Language, 1960 SOURCE-COMPUTER. IBM-PC.
/ OBJECT-COMPUTER. IBM-PC.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 X PIC S9(6)V9.
77 A PIC S9(6).
77 B PIC S9(6).
77 W-X PIC -(6),-.
PROCEDURE DIVISION.
, ARXH.
, . DISPLAY .
........
Boole / _


3. (3 )

ALGOL
ALGOrithmic Language, 1960

,

PL/1
Programming Language/1, 1960

FORTRAN COBOL
Boole / _


3. (3 )

TO TEST :A
LOGO REPEAT 4 [FD :A RT 90]
PU SETPOS [20 20] PD
, 1967 REPEAT 4 [FD :A RT 90]
PU HOME PD
REPEAT 2 [FD :A RT 45 ]
HOME
END

LISP PROLOG (DEFUN a-exisosi (a b)


(setf apot (- (/ b a)))
LISt Processor
(princ )
PROgramming in LOGic, 1959
(princ a)
(princ x + )
(Artificial (princ b)
Intelligence - AI), (princ = 0 = )
, , (princ apot))
Boole / _


3. (3 )
BASIC
Beginners All purpose Symbolic Instruction
Code, 1964
, , ()

, . 10 REM GWBASIC
, 20 INPUT A=,A
30 INPUT B=,B
70 40 IF A=0 THEN GOTO 100
50 X=-B/A
Bill Gates Paul Allen,
60 PRINT X=;X
Microsoft,
70 END
Basic (1977). ,

(MSDOS) IBM PC (1981).
: GWBASIC, QuickBasic, Visual
Basic. (interpreter)
Boole / _


3. (3 )
PASCAL
Niclaus Wirth, 1964
,
, Program Lesson1;
Basic Var
, Num1,Num2,Sum:Integer;
. Begin
Write('Input number 1:');
Readln (Num1);

Writeln('Input number 2:');
Readln (Num2);

Sum := Num1 + Num2;
ADA Writeln (Sum);
Modula-2
End.
,
Pascal,
Boole / _


3. (3 )

C
#include <stdio.h>
, Ken int main (int argc, char* argv[ ])
Thomson Dennis Ritchie Bell Labs {
(AT&T), 1970 float a, b;
printf (A = );
( / scanf(%f, &a);
UNIX, Linux, Windows), 3D, printf(B = );
.. scanf(%f, &b);
if (a == 0) {
if (b == 0) {
. printf(\n);
}else {
, printf(\n);
. }
}else {
printf(X = %f\n, -b/a);
}
: C, C++, C# return 0;
}
Boole / _


3. (3 )
JAVA
Sun Microsystems, 1995
project
// Hello.java

import javax.swing.JApplet;
import java.awt.Graphics;
Internet public class Hello extends JApplet
C, {
@Override
public void paintComponent(Graphics g)
{
g.drawString("Hello, world!", 65, 95);
hardware, }
}
,

(virtual
machine)
Boole / _


3. (3 )

dBase CLEAR
Ashton Tate, 70 ? 1.
? 2.
? 3.
? 4.
INPUT [1..4] : TO CHOICE
DO CASE
CASE CHOICE = 1
APPEND
CASE CHOICE = 2
: dBase II, dBase III, LABEL FORM PELATES
Clipper ( ) CASE CHOICE = 3
BROWSE
xBase OTHERWISE
QUIT
END CASE
Microsoft Access
Boole / _


4. 4 (4GL)

SQL
Structured Query Language,
70
INSERT INTO YPALLHLOS
VALUES (NIKOLAOY ., 2104025342,
1000);

SELECT ONOMA, THL, MISTHOS
FROM YPALLHLOS
( WHERE HMER_PROSL = 10/5/2000
)
AND MISTHOS < 1200;

(.. ,
)

Boole / _



/ (Windows,
MacOS, ) -/.

, .

:
(event

driven programming).
, (..
click, keypress .),
(visual programming).


, ,
, ).
Visual (.. Visual basic, Visual C++)
Boole / _




(procedural) ()
(non procedural)
(functional)
(object oriented)









Boole / _


,


.
.
3D,
,
,
2-3 ,

Boole / _

&
, ( )
:

(, , , .. -, 0-9,
#,%,$,+,* )

( ,
.. )

( , .
, , ,...)
( .
)
(semantics)
, ,
Boole / _

&



( ,
, .)

-


,


Boole / _


Boole / _






,

- -

-

(top
down program design)


Boole / _






(module)






Boole / _





1960

1968, Edger Dijkstra :
GOTO Statement Considered Harmful
, ,
GOTO,
, (spagetti code)

,

:
Boole / _



GO TO,


90 PRINT ; (/, /, /)"
100 T$=INPUT$(1)

110 IF T$ <> AND T$<> GOTO 210
- 120 INPUT :";DEPOSIT
130 BALANCE = BALANCE + DEPOSIT
, 140 PRINT USING : $#####.##";BALANCE
150 GOTO 90
210 IF T$ <> AND T$<> GOTO 300
220 INPUT ";CHECK
spaghetti code 230 BALANCE = BALANCE - CHECK
240 PRINT USING : $#####.##";BALANCE
250 GOTO 90
300 IF T$ <> AND T$<> GOTO 90
410 PRINT USING /: $#####.##";BALANCE
430 END
Boole / _












Boole / _




(Object Oriented Programming OOP)


, .

.
.. .
: , , , ,
: , , ,



Boole / _




(Parallel programming)



,
,
.

,
, .
( ,
, , .)
Boole / _

&


:
(Editor)

(Compiler Interpreter)
(Linker)

:
Boole / _

&

(Editor)
.
.
, ..
/
,

, ..
, ,

, , .
Boole / _

&
(Compiler Interpreter)

/, . .

,
( - source code)

( - object)
(.. ),
,
(.. )
. ,
, .
Boole / _

&
(Linker)
(object)
.

( libraries) ,
, ,


(linker),
(executable)

(compiling and linking) (build)




Boole / _



,
,
, (, /
),
,
(Graphical User
Interface GUI)
,



, .. ,
,
,
, ..
Boole / _

1.
: C
: main.c
(
)

2.
: main.c MS-DOS

: main.obj ( ;)
( .
)

3.
: main.obj
: main.exe
( /)
Boole / _



Integrated Development Environments (IDE)















Boole / _


(syntax errors)




,

(logical errors bugs)
,
( ), ..
, .


() , .. 0,
, .
Boole / _


&

Boole / _

,

( Top-Down)
.



,

Boole / _


(. )
( )
1.
1.1

1.2
2.
2.1

2.2

2.3

2.4

3. /
3.1

3.2

3.3

,
(subprogram)
Boole / _



/






.
: ,


,
, ()
,

Boole / _




( )

( )


,


,
,


.
, ,

Boole / _


,

(. )
,
( )

,
,
(.. 15, ,
15.6, ) (.. X+15, y-2x)
Boole / _

( , , .)

, .

, .

, ( )

, .
(

)
Boole / _




, ,
. ,

,

(1, 2, ...)



_1 : 1
_2 : 2
()


/
_
Boole / _


()
, ,
, (,)
, ,
. ,
,
,

1 ,
1:1
: x1, y1 ,

x1 5
y1 10 ,
(x1, y1)
(5, 15, y1) .
(x1+5, x1+y1) ,
_

Boole / _




, ,

.
, .
,
: , , ,

(1, 2, ...) : _



_1 : 1
_2 : 2
()

,
/
_ ( )
_
Boole / _


()
,
(.. (x), _(x), ).
,
.
,


,
1 1:1
,

: , x
,

x 50 .
(x,40,60)
,
_

Boole / _



,


,

( ),

:
,
1 1,
.
,
, ,


Boole / _


-

3
:
,,
45
( . , , 1.80)
_
!
(, age, )

: 3
: age ,,
:

, , , age, ,
_
Boole / _


80 1.75
:
()
( 80, 1.75, )

_

(, , )

: , ,

/ (^2) 26.12
_
Boole / _




(, ):

: , ,
(),


/ (^2)

_ ( 70, 1.75 )

(, , ) (),

.
: , , ,
-
/ (^2) ()
_ ( 70, 1.75, )
Boole / _

;

: :

>= 2 , -


_(,,,x1,x2) (, )
(x, y) (x, , )
(x, A, N)
(, )
(, )
(, )
(, ) _( (, ) )
(x) ()
Boole / _


#1



, : ,

5
10
(, )
, ,
_

(x, y)

: x,y,z

zx
xy
yz
_
Boole / _


#2


,
: x

( , x)
. :, x
- _
,
(, )


: :
:

,
(..
) _
Boole / _


#3
,

: ,
,
; (/)
(, , , )
, _
,
( , 1, 2, )

: : , 1, 2,

- ;(/) _
- : (/)
- : (/)
- ... _ = 1 = 2
_
Boole / _


#4
, ()

100 : [100],
,
1 100
[ ]
_
_

()
: [100], [100]
: [100],
()
() 1 100
() [ ]
() _
_ _
Boole / _


#4 -
,
,
,

_():

: [100], ,
. :

( )
0
1 100 _ _ ( )
+ [ ]
_ _ ( )
_
_, _
_ / 100
_
Boole / _


#5

(, ) :
,
: [100],
:
:


100 1
<= 100 =
[ ] = X TOTE
!

+1
_
_

_
Boole / _


#6
,
100

(, ) :

: i, , [100],

0
i 1 100
[ i ] = X TOTE
+ 1
_
_

_
Boole / _


#7 () 1/10

, ,

( )
, . ,
,
, (7),
(17)
,
, ,

/,
. ,
(
).

Boole / _


#7 () 2/10
(top down),

1.
( )
2. ;
2.1 ( + ).
: ,
.
,

2.2 ,
. 1-7=, 8-24=
3.

4.

Boole / _


#7 () 3/10

Top Down
0.

1. 2. 3. 4.
;
(;)

2.1 2.2


Boole / _


#7 () 4/10
-



: ,
:

_
( ) !
( ) !
( , ) !

( (/);, , , )
_ <>

_
Boole / _


#7 () 5/10
:

( )

:

_
(-) :

_ >= A KAI <=
_

, (),
()
Boole / _


#7 () 6/10

: (;)

() :

:
: , [24]

() ! .
( , ) !
( <= 7) ! 7;
_

Boole / _


#7 () 7/10

:
( )

: [24]

[1] ! 7
.............. !
[7]
[8] !
...... !
[24]
_

, (),
()
Boole / _


#7 () 8/10
:
( , ):

: , [24]
: i,

0 !
i 1 24
[ i ] = TOTE
i
_
_


_
Boole / _


#7 () 9/10

:
( , )

:
:

=
, ,

, ,
_
_

,
.
Boole / _


#7 () 10/10

(, 1, 2, )

: , 1, 2,

_


_ = 1 = 2
_

Boole / _




(....)


http://users.sch.gr/iordanissav