- What is an array ?
- What is it for ?
- How is the declaration ?
- Explain how to use it !
- How can we declare two or more dimension in array and explain the usage.
- Suppose we have n : array[char] of byte; Is it valid ? Explain.
Practices
A. Easy (10 min)
- Make a Pascal triangle, example :
Input : 7
Output : 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
- Suppose you have an array 100 elements of random numbers. Find its maximum and minimum value of the elements.
B. Intermediate (20 min)
- Make matrix operations : addition, subtraction, multiplication and division. You may limit the maximum dimension of the matrix.
- Make a menu that highlights the selection. User can press up and down arrow and press enter to make a choice.
C. Challenge (45 min. Choose one of these)
- Make a jackpot game. It has 4 digits. Each digits is represented by numbers. Jackpot can have 4 players to play. Each players has $500 at start and must place their bet of $20 every game. Winning points :
Remember, in one digit, possible primes are : 2, 3, 5, and 7 only. Example :
If
Bet returned plus bonus
Any two numbers are the same
10%
Any three are the same
25%
All four numbers are the same
100% (bet doubled)
All four are in sequence e.g. 1 2 3 4 or 5 4 3 2
50%
All four are even or all odd e.g. 1 7 5 3 or 2 6 4 8
5%
All four are prime numbers
10%
Two numbers are the same and the other two are the same too
75%
None of above
bet lost
Players lose if he/she has less than $20 and cannot continue the game. The winner is who can stay after all players are gone.
Sequence
Bonus
1 1 2 2
75%
2 1 2 1
75%
2 1 2 2
25%
9 5 3 7
5%
7 2 3 5
10%
4 3 2 1
50%
1 8 3 2
lost
- Make a blackjack game for 4 players. Players put their bet in the pot. The winner get the pot. Initially, players has $500. Each bet minimal $5. Players lose if he/she has less than $5 and can not continue the game. The winner is who can stay after all players are gone. Winning rank :
- Instant blackjack (Ace of spade and Jack of spade)
- Blackjack (any Ace and jack of the same pattern)
- Blackjack (any mixed ace and jack)
- Indirect blackjack (all summed up of 21)
- Bingo (5 cards already but is 21 or less/not burnt out)
- Any number (the bigger the score, is the winner)
- Instant blackjack (Ace of spade and Jack of spade)
- Make a poker game. The rule is the same as blackjack, but you may raise, drop, or follow. (Just like normal poker game)
- Space invader revisited.
Last time you made space invader. Now you make a full version of Space Invader with matrices of enemies. You may extend it with bonus stages or UFO. All rules remain the same.