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

Username:   Password: 
 RegisterRegister   
 if and elsif help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
gagster1233




PostPosted: Thu Nov 05, 2009 7:40 pm   Post subject: if and elsif help

What is it you are trying to achieve?
divide a class into two groups depending on the first letter of their last name a-h (Group 1) i-z (Group 2)

What is the problem you are having?
cant get the program to recognize the letters to sort them using "if"


Describe what you have tried to solve this problem
Different variables (cant try much still new to programming)


Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Kharybdis




PostPosted: Thu Nov 05, 2009 8:04 pm   Post subject: RE:if and elsif help

Well, post the code to see what you have come up with so far so we can help you.
Superskull85




PostPosted: Thu Nov 05, 2009 10:39 pm   Post subject: RE:if and elsif help

To get the first character of any string variable use MyString (1). You can than compare the first letters by finding the ordinal (ord (MyChar)) value of each letter and seeing if the letter is within the letter ordinals in Turing's character set (found in the Turing help files called "Run Window Character Set").

Another useful function to use is Str.Lower (MyString) (or Str.Upper (MyString)) as the function will convert the case of the first letter so that it is always in lower case (or upper case).

If you post your code than we might be able to help you expand on the code you have already written.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: