Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Word processor help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
evildaddy911




PostPosted: 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
Turing:
var ___ : array char of boolean


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>

Turing:


<Add your code here>



Please specify what version of Turing you are using
4.1.1



word processor.t
 Description:
a word processor program (currently under developement)

Download
 Filename:  word processor.t
 Filesize:  693 Bytes
 Downloaded:  51 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: 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)
Turing:
var __ : array char of boolean
% So we can't write
__ (1) := false
% But we can write
__ ('1') := false
% Which is the index of character 1

% This means we can't use
for i : lower (__) .. upper (__)
/* something with*/ __ (i)

% Since lower and upper produces integers


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
Turing:
for ch : char
/* something with*/ __ (i)


Hope this helps.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: