- Messages
- 17
- Reaction score
- 3
- Points
- 13
Hi, need help on this
Computing 9691
Paper 21 may/june 2011
Question 3 part c
http://www.xtremepapers.com/papers/CIE/Cambridge International A and AS Level/Computing (9691)/9691_s11_qp_21.pdf
This is rather a tough one so any solution along with explanations like which statement does what along with simple variable names.
Thanks in advance
3 C
The questions is when the program reads the letter how is it going to increase the counter, if it is in a one dimension arrary it will be like this
VB 6
1: Dim arrary ( 1 to 26 )
2: Letter_found = Lcase ( Letter_found)
3: Letters_num = ( Asc ( Letter_found ) - ( Asc ( " a" ) ) + ( 1 )
4: arrary ( Letters_num) = arrary ( Letters_num) + 1
What i have done in the second line is, that i have found the number of the letter
for example if " c " is the letter , the counter in the 3rd index of the arrary must increase because " c " is 3rd letter in the alphabet , in this case it happens like this
ASCII No of " a " = 97
ASCII No of " c " = 99
Letter Num = ( 99 - 97 ) + ( 1 )
Letter Num = 3
arrary [ 3 ] = arrary [ 3 ] +1 Here the counter is increase by one for the previous value
First i turn it to lcase is because otherwise all the values are incorrect
Hope This Is Helpful !!