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

Username:   Password: 
 RegisterRegister   
 using real numbers in case?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bvbjules13




PostPosted: Sat Jan 12, 2013 5:14 pm   Post subject: using real numbers in case?

What is it you are trying to achieve?
i am trying to use a decimal (or real number) in a case statement

What is the problem you are having?
keep getting message of "Bad type for case expression"

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:

%trying to make sure the random integer is able to be divided by 50
houseX (i) := Rand.Int (100, 750)
check := houseX (i)/50
        loop
            case check of
                label 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 :
                    exit
                label :
                    houseX (i) := Rand.Int (100, 750)
            end case
        end loop



Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Jan 12, 2013 5:34 pm   Post subject: RE:using real numbers in case?

There's a much, much easier way to do this. Look up the 'mod' operator.


Also, if your case statement only has one case (plus the default case), you probably shouldn't be using a case statement.
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: