Computer Science Canada Word processor help |
Author: | evildaddy911 [ Wed Feb 08, 2012 11:41 am ] | ||||
Post subject: | Word processor help | ||||
What is it you are trying to achieve? a word processing program What is the problem you are having? im having trouble using
Describe what you have tried to solve this problem I cant think of anything to do about it! Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using 4.1.1 |
Author: | Dreadnought [ Wed Feb 08, 2012 12:45 pm ] | ||||
Post subject: | Re: Word processor help | ||||
Well, I'm not sure what the issue is... But from your code I see that there is some confusion. If we read the documentation for char we notice the line Turing Docs wrote: The char type is an index type and can be used, for example, as subscripts, for ranges and case labels. For example, this declaration
This means that char can designate the range of all characters. But note that these are characters and not integers. (char is 8 bit, integer is 32 bit)
So if we can't use numbers for indices, how can we run a for loop to go through all characters? Simple, just read the line I quoted. "The char type [...] can be used [...] for ranges. So the range of the for can be char. Example
Hope this helps. |