pratice_your_basic.pdf

(34905 KB) Pobierz
[^PRACTISE YOUR fii
Puzzles,tests and problems to improve your skills II
USBORNE EXERCISE BOOKS
.Gaby Waters and Nick Cutler
llustrated by Naomi Reed
Designed by Graham Round
Editor: Lisa Watts
Contents
4
6
8
10
12
14
16
19
20
21
22
24
26
27
28
34
45
47
48
Getting to know BASIC
Variable puzzles
Repeating things
Loop puzzles
IF/THEN exercises
Random numbers
Character crunching
Code writing programs
INKEY$ exercises
How to write a car crash game
DATA puzzles
Using arrays
Writing subroutines
Fruit machine program to write
How to write a treasure hunt program
Program answers
Guide to BASIC
Conversion chart
Index
About this book
This book contains lots of exercises,
puzzles and problems to solve by
writing programs, to help you practise
your BASIC. There are programs with
missing lines and variables to fill in,
listings full of bugs to spot and correct,
and ideas for programs to write
yourself. The book covers all the most
important BASIC commands, starting
with simple PRINT statements and
ending with guidelines for writing a
long program for a treasure hunt
game.
Sometimes the program lines in the
answers will differ from the ones you
write yourself. If your program runs
alright, don't worry, there are often
several ways of writing the same
program. Try comparing your
answers with the ones in the book to
see which method is the most
effective.
-BUG
Programs filled with bugs and
mistakes are marked with a "bug" like
the one at the beginning of this
paragraph. This tells you to hunt for the
mistakes and correct them so that the
program runs properly. Other
programs have lines and variables to fill
in. The lines you have to complete are
marked with an asterisk and the spaces
to fill are marked with cfuestion marks.
All the programs in this book are
written in a standard BASIC which
means that they should run without
much alteration on most computers.
Some words are different on all computers
so if you type in a program and get a bug
you should check the BASIC words in the
program. There is a conversion chart to
help you on page 47.
If you are not sure what a BASIC
command does, there is a guide to
BASIC which lists all the words used in
this book and gives a brief explanation
of each one. Special guidelines are
given for writing programs on Sinclair
(Timex) computers and there are also
alternative answers for these
computers.
The answers to all the puzzles and
program projects are given at the
back of the book with detailed
explanations. Use the answers to help
you when you get stuck especially in
the longer programs. Often the
answer to a problem in the first few
lines can help you solve later
problems or give you a hint to writing
the rest of the program on your own.
Zgłoś jeśli naruszono regulamin