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

Username:   Password: 
 RegisterRegister   
 A quick quiz
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
qmanjr5




PostPosted: Mon Nov 30, 2009 7:10 pm   Post subject: A quick quiz

What is it you are trying to achieve?
A quiz with a score that will go up or down depending on your correct questions


What is the problem you are having?
Can't figure out quite how to do this


Describe what you have tried to solve this problem
I've asked my friends.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
I've only done a TINY bit, but, here it is.

Turing:


var score := int = 0
var answer1 := int = 2
put ""
get answer1
if answer1 = "2" then
    procedure correct
end
procedure correct
    score + 1




Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Mon Nov 30, 2009 7:39 pm   Post subject: Re: A quick quiz

Well first off. procedures should be declared before their used, and deffinitly not in a loop. Try sorting you code like this:

Turing:
%Declare Variables
var number:int

%Procedures and Functions
procedure incrementNumber
number += 1
end incrementNumber

%Initialize Variables
number := 0

% Main Program Code
put "I'm a number ",number
incrementNumber
put "Now I'm a number ",number


Honnestly your missing alot of the programming basics. Try running through the first few subjects of the Essentials in the Turing Walkthrough
qmanjr5




PostPosted: Mon Nov 30, 2009 7:59 pm   Post subject: RE:A quick quiz

And I shall.

Thank you. Very Happy
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  [ 3 Posts ]
Jump to:   


Style:  
Search: