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

Username:   Password: 
 RegisterRegister   
 Program not continuing.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TrainsAreTrains




PostPosted: Sat Nov 07, 2015 3:04 pm   Post subject: Program not continuing.

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
I'm fairly new to turing, (taking an introductory course) and I came across a problem with my code, it does not continue after the two variables have been entered, the program just finishes.


Describe what you have tried to solve this problem
I've tried "then" statements, and I can't think of anything else, which is why I came to this forum.


Turing:


var rock: string
var paper: string
var scissors: string
var entered1: string
var entered2: string
put "player 1 enter rock, paper, or scissors"
get entered1
put "player 2 enter rock, paper, or scissors"
get entered2
if entered1=rock and entered2=scissors then
    put "player1 wins"
  end if
if entered1=scissors and entered2=rock then
    put "player 2 wins"
  end if
if entered1=paper and entered2=scissors then
    put "player2 wins"
  end if
if entered1=rock and entered2=paper then
    put "player2 wins"
  end if
if entered1=paper and entered2=rock then
    put "player1 wins"
  end if
if entered1=scissors and entered2=paper then
    put "player1 wins"
  end if




Please specify what version of Turing you are using
I am using turing version 4.1.1


*Added note: I'm sorry if I used the wrong formatting, I'm very new to this.

Thanks in advance for the help!
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Nov 07, 2015 3:36 pm   Post subject: RE:Program not continuing.

The variables rock, paper, and scissors have no value. Your program isn't 'just finishing', it's crashing, and Turing is probably giving you an error message like 'variable rock has no value'. Maybe add a few lines like 'rock := "rock"'.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: