Sunteți pe pagina 1din 4

Bordei Maria INF1210G

1.

Desenai o schem logic i un graf pentru urmtorul program:

1. Program OddandEven
2.
3. A,B:Real;
4. Odd:Integer;
5.
6. Begin
7.
Read A
8.
Read B
9.
C=A+B
10.
D=A-B
11.
Odd=0
12.
13. If A/2 DIV 2<>0
14. Then Odd=Odd+1
15. Endif
16.
17. If B/2 DIV 2<>0
18. Then Odd=Odd+1
19. Endif
20.
21. If Odd=1
22. Then
23.
Print(C is Odd)
24.
Print(D id Odd)
25. Else
26.
Print(C is even)
27.
Print(D id even)
28. Endif
29. End

Bordei Maria INF1210G

Schema logic
Program OddandEven
Program
A,B:Real;
Odd:Integer;

Read A
Read B
C=A+B
D=A-B
Odd=0
if

else
then

A/2 DIV 2<>0

Odd=Odd+1
Endif
if

else
then

B/2 DIV 2<>0

Odd=Odd+1
Endif
if

else
then

Odd=1

Print(C is odd)
Print (D is odd)
Endif

Print(C is even)
Print (D is even)

Bordei Maria INF1210G


End

Endif

Graful

B/2 DIV 2<>0

e
Endif
g

Bordei Maria INF1210G

A/2 DIV 2<>0

De cte teste va fi nevoie pentru o acoperire de 100% a instruciunilor?


Testul 1.
A = 6; B = 6;
Se va parcurge graful n modul dat: c,f,i,p.
Testul 2.
A = 2; B = -2;
Se va parcurge graful n modul dat: a,b,f,g,h.
Testul 3.
A = -3; B = 1;
Se va parcurge graful n modul dat: c,d,e,g,h.
Testul 4.
A = 3; B = -3;
Se va parcurge graful n modul dat: a,b,d,e,i,p.

Odd=1

Endif

Endif

End

S-ar putea să vă placă și