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

Username:   Password: 
 RegisterRegister   
 Problem with Restarting Loop, and Counter
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
QuantumPhysics




PostPosted: Mon Oct 15, 2012 9:23 pm   Post subject: RE:Problem with Restarting Loop, and Counter

instead of myCounter = myCounter + 1;
use myCounter += 1;
it does the same thing, its more shorter and efficient in the same manner.Smile
Sponsor
Sponsor
Sponsor
sponsor
tristanbryce7




PostPosted: Tue Oct 16, 2012 4:28 pm   Post subject: Re: Problem with Restarting Loop, and Counter

To be honest, I dont know what increment means lol.
I dont know where else to put the
myCounter += 1 statement to make it much more efficient. I'll ponder over it thought
tristanbryce7




PostPosted: Tue Oct 16, 2012 4:34 pm   Post subject: Re: Problem with Restarting Loop, and Counter

and taking Claytons and QuantamPhysics advice
i changed it to

Turing:


end loop

        %The various statements that the program tells the user what their guess was in relation to the number
        myCounter += 1
        if guessInt > random then
            put "The Number you entered is too high!"

        elsif guessInt < random then
            put "The Number you entered is too low!"

        elsif guessInt = random then
            put "You got it!"

            put "It took you ", myCounter, " try/tries to find the number!" %Once they guess the correct number, this statement tells them how many tries it took them
            delay (2100) %Stops the program for 2.1 seconds before restarting the loop
            cls
            exit
        end if




and it worked either way Very Happy
Insectoid




PostPosted: Tue Oct 16, 2012 5:26 pm   Post subject: RE:Problem with Restarting Loop, and Counter

Learn to use Google. Or a dictionary. Solving your own problems is the first and most important step in learning to program.
tristanbryce7




PostPosted: Tue Oct 16, 2012 5:38 pm   Post subject: Re: Problem with Restarting Loop, and Counter

Definitely, I just needed some help getting started .
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  [ 20 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: