Download Software Development

Transcript
HIGH LEVEL LANGUAGE PROGRAMMING – BASIC CONSTRUCTS
Can you alter the program to give the following output?
This is Comic Sans MS, size 28
This is Comic Sans MS, size 26
This is Comic Sans MS, size 24
This is Comic Sans MS, size 22
This is Comic Sans MS, size 20
This is Comic Sans MS, size 18
This is Comic Sans MS, size 16
This is Comic Sans MS, size 14
This is Comic Sans MS, size 12
This is Comic Sans MS, size 10
This is Comic Sans MS, size 8
Example 4.11.2 – adapting the AB_coder program to code whole
words
Version 2 of the AB_coder program from Section 4.3 can code single
characters. We can use a For ... Next loop to adapt the program to code
whole words instead of single characters.
Here is how it works (in pseudocode):
1.
2.
3.
4.
5.
6.
prompt the user to enter a word
check how many characters there are in the word
create a new ‘empty’ coded word
repeat the following for each letter in the word
4.1. extract the letter from the word
4.2. code it
4.3. add it on to the new coded word
next letter
display coded word ...
SOFTWARE DEVELOPMENT (INT 2, COMPUTING)
117