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

Username:   Password: 
 RegisterRegister   
 How to count each number??? (sounds confusing? read more)
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Superskull85




PostPosted: Mon Dec 07, 2009 11:00 pm   Post subject: RE:How to count each number??? (sounds confusing? read more)

Are you sure you ran mirhagk's code on its own? I can only type eight characters using his/her code, nothing more.
Sponsor
Sponsor
Sponsor
sponsor
qmanjr5




PostPosted: Mon Dec 07, 2009 11:24 pm   Post subject: RE:How to count each number??? (sounds confusing? read more)

Don't be rude to tony either, dude. He'll kill you Very Happy

Just be patient with him, and he'll be patient with you
mirhagk




PostPosted: Mon Dec 07, 2009 11:30 pm   Post subject: RE:How to count each number??? (sounds confusing? read more)

my code only works if you only want exaclty 8 characters (enter would be a 9)

the best way to do it would be to check the length and make sure each number is either a 1 or a 2.

Turing:

var binary:string
var done:=false
loop
      get binary
      if length(binary)=8 then
done:=true
for i:1..8
if binary(i) not="1" and binary(i)not="2" then
done:=false
end if
end for
end if
exit when done
end loop
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 2 of 2  [ 18 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: