Now, let's have a quiz ! If you haven't read the lesson, you had better do it now before starting.
1 2 3 4 5 6Write an excerpt using all three syntaxes !
In part II, I will give you the sample input and output. You must write an excerpt, using only ONE of the loop syntaxes provided by Pascal. The choice is up to you. As long as they can be run correctly, you get the points. Tip : Before entering this quiz, practise a lot !
1. Input : 5 2. Input : 5 Output : 1 2 3 4 5 4 3 2 1 Output : 1 2 3 4 5 Input : 1 1 2 3 4 5 Output : 1 1 2 3 4 5 1 2 3 4 5 3. Input : 5 1 2 3 4 5 Output : 1 2 3 4 5 4. Input : 5 2 3 4 5 1 Output : 1 3 4 5 1 2 1 2 4 5 1 2 3 1 2 3 5 1 2 3 4 1 2 3 4 1 2 3 4 5 5. Input : 5 6. Input : 5 Output : 1 Output : 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5
Here is the criteria -- If you solve it correctly in :
Time in minutes | Category |
---|---|
<= 3 | Amazing ! |
3 < time <= 6 | Great ! |
6 < time <= 10 | Very good ! |
10 < time <= 15 | Good ! |
15 < time <= 20 | Average |
20 < time <= 25 | Below average |
> 25 | Poor |
7. Input : 5 8. Input : 5 Output : 1 Output : 1 1 1 1 1 1 2 1 1 2 2 2 1 1 2 3 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 2 2 1 1 2 3 4 5 4 3 2 1 1 1 1 1 1 1 2 3 4 4 4 4 4 3 2 1 1 2 3 3 3 3 3 3 3 3 3 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Input : 100 Input : 1001 Output : 100 Output : 1001 / \ /\ 2 50 7 143 /\ /\ 2 25 11 13 /\ Input : 5 5 5 Output : 5 is a prime !
Here is the criteria -- If you solve it correctly in :
Time in minutes | Category |
---|---|
<= 5 | Amazing ! |
5 < time <= 10 | Great ! |
10 < time <= 15 | Very good ! |
15 < time <= 20 | Good ! |
20 < time <= 25 | Average |
25 < time <= 30 | Below average |
> 30 | Poor |
Create a game just like a space invader (you've got to know that), but in normal text mode (80x25). Use colors as pretty as possible. Normally space invader have a matrix of enemies, but I make allowances to you. You just make only one enemy. If the enemy is destroyed, it just reappears at a different place and the player gains a point. Each players have 3 ships to play. If all ships are used up (shot down) you show Game Over message and ask if the player want to play again. Each enemy ship scores 10. Player got an extra ship when reaches 500 and its multipliers (1000, 1500, 2000,...). Players can only have one shot. Before the fire is out, players can not trigger another shot. The same rule applies for the enemy. Player could only move his/her ship horizon tally (left or right), not vertically or diagonally. The enemy may come closer to the ship after it reaches the edge (of left or right). I mean that the enemy ship go left or right, after it touches the edge, it advances a bit -- just like a normal space invader game. Make it as fancy as possible.
If you made it correctly in :
Time in minutes | Category |
---|---|
<= 15 | Amazing ! |
15 < time <= 25 | Great ! |
25 < time <= 30 | Very good ! |
30 < time <= 35 | Good ! |
35 < time <= 40 | Average |
40 < time <= 45 | Below average |
> 45 | Poor |
That's it !
By : Roby Joehanes, © 1996, 2000