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

Username:   Password: 
 RegisterRegister   
 Why isn't the input working? Look to see code
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
noobsauce




PostPosted: Tue Oct 14, 2008 6:14 pm   Post subject: Why isn't the input working? Look to see code

Here is the code:
var name : string (100)
var timetoexit : char
loop
locate (8, 12)
get name : *
cls
get timetoexit
exit when timetoexit = 'n'
end loop
for some reason turing only get the name 1ce, it skips the input for name after the first time? Anyone know what is wrong and how i can fix it? thanks
Sponsor
Sponsor
Sponsor
sponsor
The_Bean




PostPosted: Tue Oct 14, 2008 7:06 pm   Post subject: Re: Why isn't the input working? Look to see code

I believe that it's the ": *" after get name that is causing the problem.
noobsauce




PostPosted: Tue Oct 14, 2008 7:10 pm   Post subject: Re: Why isn't the input working? Look to see code

So do I have to input name as different strings, or is there an alternative way?
andrew.




PostPosted: Tue Oct 14, 2008 7:10 pm   Post subject: RE:Why isn\'t the input working? Look to see code

You declared the variable as 100 characters in the string, I think you should take out the 100 in the declaration, or you should change the * to 100.
The_Bean




PostPosted: Tue Oct 14, 2008 7:13 pm   Post subject: Re: Why isn't the input working? Look to see code

To fix this turn timetoexit into a string of length 1
and use getch(timetoexit)
Turing:

var timetoexit : string(1)
getch (timetoexit)
noobsauce




PostPosted: Tue Oct 14, 2008 7:13 pm   Post subject: Re: RE:Why isn\'t the input working? Look to see code

andrew. @ Tue Oct 14, 2008 7:10 pm wrote:
You declared the variable as 100 characters in the string, I think you should take out the 100 in the declaration, or you should change the * to 100.

Doesn't seem to be workjing Sad I've tried both method but the program still ignoring the the fact that I put get name
noobsauce




PostPosted: Tue Oct 14, 2008 7:16 pm   Post subject: Re: Why isn't the input working? Look to see code

The_Bean @ Tue Oct 14, 2008 7:13 pm wrote:
To fix this turn timetoexit into a string of length 1
and use getch(timetoexit)
Turing:

var timetoexit : string(1)
getch (timetoexit)

Doesn't work perfectly as it skips the input for name right after but is fine for the time after, so wasted a loop everytime i type name-.-
The_Bean




PostPosted: Tue Oct 14, 2008 7:19 pm   Post subject: Re: Why isn't the input working? Look to see code

You might not have put them in the right spot. Those two lines were just what you should replace the others with, they shouldn't appear like that in the code.
Sponsor
Sponsor
Sponsor
sponsor
noobsauce




PostPosted: Tue Oct 14, 2008 7:25 pm   Post subject: Re: Why isn't the input working? Look to see code

Thanks, works perfect:D
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  [ 9 Posts ]
Jump to:   


Style:  
Search: