Tackling the Narrative!
Hello there! Glad you could join me for this weeks post. As I promised, we will now move on. Before we get to the algorithm though, we might want to tackle the Narrative section of the IA.
This section is probably the easiest part of the IA you'll meet up on as there is not much syntax or rules to worry about (only those of the English language ;)). This section is closest in nature to English as you will simply need to state the steps to solve your problem in English-lke statements. This is similar in nature to the way recipes for dishes are expressed. Example, suppose you needed to accept a list of names into an array:
Create an array called Students
For the 10 spaces in the array
Prompt the user for a student's name
Accept the name and store it in the current space in the array Students
As is evident in the example above, you want to practice good programming style by using white spaces and indentation as you want your solution to be completely readable to you or whoever else is reading it later on. You must avoid using syntax particular to C or any other programming language such as for count = 1 to 10, as the purpose of the Narrative is to list the logical steps that will be involved in solving the problem so that anyone viewing the logics can implement it in any programming language they wish. Do not pack too much information into one line as your 'recipe' will start developing a bad structure and may start looking like a story. You want to keep your statements explicit yet concise; one instruction (two the most) per line would be ideal. Example, suppose you wanted to accept 5 numbers into an array, calculate their sum and their average then output the sum and the average:
Create an array called Numbers
Create integer variables called sum, avg
For five turns, do the following:
Prompt the user for an integer
Accept the number and store it in Numbers
Increment sum by adding to it the value just entered
Divide sum by 5 and store the result in avg
Display the sum and the average
For an idea of how to express various concepts in your Narrative such as FILES, structures, arrays etc, visit the Narrative page in the Gallery.
Complete that and join me next week as we take on the more challenging section: Algorithm.
Jase-Omeileo West
Author,