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

Username:   Password: 
 RegisterRegister   
 Cartoon Character Helppppp!!!!!!!!!!!!!!!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZZK




PostPosted: Sun Apr 04, 2010 3:45 pm   Post subject: Cartoon Character Helppppp!!!!!!!!!!!!!!!!!

I want to take out alot of the bugs from my program with peoples help and advice?
Main issue i want to clear is that i want to know how i can not make the program ever crash, and i want to know how i can keep the things that the people change to my cartoon character.
Turing:


Turing 1.1.4



OSTAN.T
 Description:
HERE IS THE PROGRAM, and thank you for the help

Download
 Filename:  OSTAN.T
 Filesize:  20.15 KB
 Downloaded:  199 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
andrew.




PostPosted: Sun Apr 04, 2010 7:58 pm   Post subject: RE:Cartoon Character Helppppp!!!!!!!!!!!!!!!!!

It seems that your program crashes when you type in a string. This happens because you created an integer and Turing cannot store a string in that space. The only way around this (as far as I know) is to use the strintok command. This function will return a boolean value; true if it's okay, and false if it's not. Here's an example:

Turing:
% Creating a string and an integer
var myString : string := "Hello"
var myInt : int

% We are checking to see if the string is an integer
if strintok(myString) then
    myInt := strint(myString)
else
    put "myString cannot be saved into an int" % The string isn't an integer, so it will do this
end if
   
% Now we change it to a number
myString := "12345"

% And check again
if strintok(myString) then
    myInt := strint(myString) % This time, it's okay for the string to be converted to an int so we save it
else
    put "myString cannot be saved into an int"
end if


Basically, use strintok to check if a string can be converted. If not, you can just ignore the input, and if it can, then continue normally.

By the way, please update your version of Turing (1.1.4). It is extremely old. Click Turing at the top of this page and you will find a download link for the newest version.
TheGuardian001




PostPosted: Sun Apr 04, 2010 9:16 pm   Post subject: Re: RE:Cartoon Character Helppppp!!!!!!!!!!!!!!!!!

The only way to save changes is to write them to a file. Look into open and close, which are the two main file commands you'll need to know (actually putting things into the file just uses a slightly modified put command.)

andrew. @ Sun Apr 04, 2010 7:58 pm wrote:

By the way, please update your version of Turing (1.1.4). It is extremely old. Click Turing at the top of this page and you will find a download link for the newest version.


Minor correction, get the second newest version (4.1, not 4.1.1a). That way compiling will work, and we might avoid yet another "What the hell does bad object header mean?" thread.
andrew.




PostPosted: Mon Apr 05, 2010 10:18 am   Post subject: RE:Cartoon Character Helppppp!!!!!!!!!!!!!!!!!

Here is a tutorial on file input/output.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: