30.06.2013 Aufrufe

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

548 B. Vollständige Implementation des Memory Spiels<br />

10 ∗ @param front symbol the f r o n t symbol o f the card<br />

11 ∗ @param back symbol the symbol f o r the back o f the card<br />

12 ∗/<br />

13<br />

14 MemoryGameCard : : MemoryGameCard( const char ∗ front symbol ,<br />

15 const char ∗ back symbol ) :<br />

16 GameCard(BACK SIDE ) , Displayable ( )<br />

17 {<br />

18 i f ( front symbol )<br />

19 {<br />

20 front symbol = new char [ s t r l e n ( front symbol ) + 1 ] ;<br />

21 strcpy ( front symbol , front symbol ) ;<br />

22 }<br />

23 else<br />

24 {<br />

25 front symbol = new char [ 1 ] ;<br />

26 front symbol [ 0 ] = ’ \0 ’ ;<br />

27 }<br />

28<br />

29 i f ( back symbol )<br />

30 {<br />

31 back symbol = new char [ s t r l e n ( back symbol ) + 1 ] ;<br />

32 strcpy ( back symbol , back symbol ) ;<br />

33 }<br />

34 else<br />

35 {<br />

36 back symbol = new char [ 1 ] ;<br />

37 back symbol [ 0 ] = ’ \0 ’ ;<br />

38 }<br />

39 }<br />

40<br />

41 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

42 /∗<br />

43 ∗/<br />

44<br />

45 MemoryGameCard : : ˜ MemoryGameCard( )<br />

46 {<br />

47 delete [ ] front symbol ;<br />

48 delete [ ] back symbol ;<br />

49 }<br />

B.1.7 Implementation von MemoryGameboard<br />

1 //memory gameboard . cpp − implementation o f the Memory Gameboard<br />

2<br />

3 #<strong>in</strong>clude ”memory gameboard . h”<br />

4 #<strong>in</strong>clude ” simple output handl<strong>in</strong>g . h”<br />

5 #<strong>in</strong>clude ” s i m p l e t e x t d i s p l a y a b l e . h”<br />

6 #<strong>in</strong>clude ” s i m p l e i n t d i s p l a y a b l e . h”<br />

7 #<strong>in</strong>clude ” c o n c r e t e o b j e c t d e l e t o r s . h”<br />

8<br />

9 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

10 MemoryGameboard : : MemoryGameboard( u<strong>in</strong>t32 num rows ,<br />

11 u<strong>in</strong>t32 num cols ) :<br />

12 num rows ( num rows ) ,<br />

13 num cols ( num cols ) ,<br />

14 num cards front side up ( 0 ) ,<br />

15 row vector ( 0 ) ,<br />

16 r o w h e a d i n g d i s p l a y a b l e s ( 0 ) ,<br />

17 c o l h e a d i n g d i s p l a y a b l e s ( 0 ) ,<br />

18 e o l d i s p l a y a b l e s ( 0 ) ,<br />

19 conta<strong>in</strong>er output handl<strong>in</strong>g ( 0 ) ,<br />

20 c o n t a i n e r o u t p u t c o n t e x t (0)

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!