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

Username:   Password: 
 RegisterRegister   
 invalid integer input?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Velocity




PostPosted: Mon Nov 28, 2011 3:50 pm   Post subject: invalid integer input?

As i mentioned inside the program there is an invalid integer input and i dont understand what the problem is, i want the program to store the word that it generates from a list of 20 words and keep it in mind, but i dont understand why it says invalid integer input, i also want to test to see which of the words the program outputs, with a put statement, just so i know im on the right track.

p.s its a hangman game

p.s.s i will reward you with bits or even karma if you can help me out



Hangman.t
 Description:

Download
 Filename:  Hangman.t
 Filesize:  2.74 KB
 Downloaded:  90 Time(s)


Hangman.t
 Description:

Download
 Filename:  Hangman.t
 Filesize:  2.74 KB
 Downloaded:  72 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Velocity




PostPosted: Mon Nov 28, 2011 4:10 pm   Post subject: RE:invalid integer input?

BUMMPPP 69 bits to helper!!! need legit help.
DemonWasp




PostPosted: Mon Nov 28, 2011 4:13 pm   Post subject: RE:invalid integer input?

Well, most words aren't integers, they're strings. Why didn't you declare wordList as an array of strings?

Also, please just fill out the help template in the future...downloading your file to look at it is a pain.

Edit: Don't bump within 20 minutes, either. Be patient.
Velocity




PostPosted: Mon Nov 28, 2011 4:17 pm   Post subject: RE:invalid integer input?

okay thaanks, i just thought it would be a very long syntax code, so i just downloaded it as a file, would you prefer bits or karma?
Velocity




PostPosted: Mon Nov 28, 2011 4:19 pm   Post subject: RE:invalid integer input?

wait but if i set it as a string, its not going to return an integer value, cause after it reads the file it has to select a random string value into an integer value to generate a rand.int so if i set the array to string, it wont work as i try to generate it.
DemonWasp




PostPosted: Mon Nov 28, 2011 5:20 pm   Post subject: Re: RE:invalid integer input?

Velocity @ Mon Nov 28, 2011 4:19 pm wrote:
wait but if i set it as a string, its not going to return an integer value, cause after it reads the file it has to select a random string value into an integer value to generate a rand.int so if i set the array to string, it wont work as i try to generate it.


...what?

Your playgame procedure has the following two lines in it:
Turing:
declare := Rand.Int (1, 20)
put wordList (declare


That will work as long as declare has type int. In contrast, wordList should have type array 1 .. 20 of string. This makes sense: wordList is a list of 20 words. Words are strings.

I still haven't corrected the logic error in the loop you use to get your wordList, incidentally -- I'll let you try that first. It has to do with the starting size of your flexible array.

Save awarding karma or bits for truly outstanding efforts. A simple "thank you" is enough for most of the answers given on these forums.
Velocity




PostPosted: Mon Nov 28, 2011 5:34 pm   Post subject: RE:invalid integer input?

okay thank you Smile
Velocity




PostPosted: Mon Nov 28, 2011 5:39 pm   Post subject: RE:invalid integer input?

mind giving me a little tip along the lines of where i went wrong in my flexible loop?
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Mon Nov 28, 2011 5:50 pm   Post subject: Re: RE:invalid integer input?

Velocity @ 28/11/2011, 4:39 pm wrote:
mind giving me a little tip along the lines of where i went wrong in my flexible loop?


Demonwasp wrote:
It has to do with the starting size of your flexible array.



You posted 5 minutes after he gave you a tip. Try and see what your telling the computer to do
Velocity




PostPosted: Tue Nov 29, 2011 11:55 am   Post subject: RE:invalid integer input?

but when i change the wordList to an array of string it doesnt work with the file i/o loop that i have created.
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  [ 10 Posts ]
Jump to:   


Style:  
Search: