[Turing] I need help FAST! Error: Invalid Integer Input
Author |
Message |
keeg
|
Posted: Mon Nov 25, 2019 1:10 pm Post subject: [Turing] I need help FAST! Error: Invalid Integer Input |
|
|
What is it you are trying to achieve?
I am creating a quiz project that is due soon.
What is the problem you are having?
I cant continue due to an error message.
The error occurs at the "get Trivia1"
Turing: |
%name:keegan
%date:November 18,2019
%program name: KeeganQuizMaster.t
%description: This program creates a quiz for someone using everything we learned.
put "Welcome to Keegan's Quiz!"
put ""
put ""
put "You are going to recieve 10 questions."
put "Try to answer them as accurately as possible."
put "Your score will be shown as you play."
put""
put "Let's begin."
put ""
var answer : int
var Trivia1 : int
var RandomInt : int
var points : int
points := 0
var num := Rand.Int(1, 10)
var num2 := Rand.Int(1, 10)
var num3 := Rand.Int(1, 10)
var num4 := Rand.Int(1, 10)
RandomInt := Rand.Int(1,10)
loop
put "ADD these numbers together."
put num
put num2
get answer
if answer=num+num2
then
put "epico! That is corect!"
put "Your score is:"
points := points+1
put points
put""
RandomInt := Rand.Int(1,10)
put""
put "Now MULTIPLY these numbers."
put num3
put num4
get answer
if answer=num3*num4
then
put "Correct again! Keep going!"
points := points+1
put "Your score is:"
put points
end if
end if
put "Now MULTIPLY again!"
put num
put num2
get answer
if answer=num*num2
then
put "WOW!"
put "Your score is:"
points := points+1
put points
put""
end if
put""
put "Now ADD again!."
put num3
put num4
get answer
if answer=num3+num4
then
put "Incredible Job!"
points := points+1
put "Your score is:"
put points
end if
put "KEEP ADDING!"
put num4
put num2
get answer
if answer=num4+num2
then
put "Amazing!!!!!!!!!!!!!!!!!!!"
put "Your score is:"
points := points+1
put points
put"Now it's time for trivia!"
put""
end if
put "What is the capital of Canada?"
put " Type ONLY NUMBERS or bad things will happen:"
put "1-Ottawa, 2-Toronto, 3-Trudeau Land, 4-Canada doesn't exist."
get Trivia1
case Trivia1 of
label 1 :
put "Correct!"
label 2 :
put "Wrong!"
label 3 :
put"That's not the right answer! (yet...)"
label 4 :
put "I'm not denying that statement."
label :
put "I don't understand"
end case
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Stickman
|
Posted: Mon Mar 07, 2022 10:24 am Post subject: RE:[Turing] I need help FAST! Error: Invalid Integer Input |
|
|
instead of this code: put "What is the capital of Canada?"
put " Type ONLY NUMBERS or bad things will happen:"
put "1-Ottawa, 2-Toronto, 3-Trudeau Land, 4-Canada doesn't exist."
get Trivia1
case Trivia1 of
label 1 :
put "Correct!"
label 2 :
put "Wrong!"
label 3 :
put"That's not the right answer! (yet...)"
label 4 :
put "I'm not denying that statement."
label :
put "I don't understand"
end case
use this:
put "What is the capital of Canada?"
put " Type ONLY NUMBERS or bad things will happen:"
put "1-Ottawa, 2-Toronto, 3-Trudeau Land, 4-Canada doesn't exist."
get Trivia1
if Trivia1 = 1 then
put "correct"
elsif Trivia1 = 2 then
put "wrong"
elsif Trivia1 = 3 then
put "wrong"
elsif Trivia1 = 4 then
put "wrong"
end if |
|
|
|
|
|
|
|