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

Username:   Password: 
 RegisterRegister   
 Some quick help...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HKYPLAYA4LIFE




PostPosted: Wed Dec 24, 2003 12:11 am   Post subject: Some quick help...

I started writing this program really quick and then I began getting errors. Please help me out quick thanks. Very Happy
(sorry about the messy from by the way)
code:
colourback(green)
cls
colour(red)
put "Hello"
delay (1000)
put "Could I please get you to enter your name: "..
var name:string
get name
delay(500)
put "Thank you ",name,"."
delay(500)
put "Rather than buying a material gift this year ",name,","
put "I decided to write you this computer program."
delay(5000)
cls
colourback(white)
colour(black)
cls
delay(2000)
put name," what would you like me to do?"
put""
put""
put "1. Open Calculator"
put "2. Open Averager"
put "3. Open one of your computer drives"
put "4. Play a game"
put ""
put ""
put "Press the number of choice then press the enter key."
put""
put""
var thing:int
get thing
if thing=1 then
cls
put "First I will need you to input two numbers that you would like to use in your mathematical equation"
var one,two : real
put "Input your first number: "..
get one
delay(500)
put "Input your second number: "..
get two
delay(500)
put"Now ",name,", what would you like to do with this two numbers:"
put""
put""
put"1. Add"
put"2. Subtract"
put"3. Multiply"
put"4. Divide"
var func :int
get func
put "Thank you ",name,"."
delay(1000)
cls
if func=1 then
put one,"+",two,"=",one + two
end if
else if func=2 then
put one,"-",two,"=",one - two
end if
if func=3 then
put one,"x",two,"=",one**two
end if
if func=4 then
put one,"/",two,"=",one div two
end if
Sponsor
Sponsor
Sponsor
sponsor
DanShadow




PostPosted: Wed Dec 24, 2003 4:00 pm   Post subject: (No subject)

Lol, such a messed program.
All your problems lie in this part of the code:
code:

else if func=2 then
put one,"-",two,"=",one - two
end if
if func=3 then
put one,"x",two,"=",one**two
end if
if func=4 then
put one,"/",two,"=",one div two
end if

else if is wrong, it is actually elsif
The variables func and one havent even been declared
Fix up these things, and it should fall into place.
Oh, also when dividing, its easier to put / instead of div
Very Happy
Thuged_Out_G




PostPosted: Wed Dec 24, 2003 9:29 pm   Post subject: (No subject)

DanShadow wrote:

The variables func and one havent even been declared


yes they have
DanShadow




PostPosted: Thu Dec 25, 2003 10:56 am   Post subject: (No subject)

Hmmmm...so they are, sorry about that. I guess Turing was drunk when I ran the program....skipped the var statements. Woops, well sorry. (And thanks for the correction Wink )
Thuged_Out_G




PostPosted: Thu Dec 25, 2003 3:33 pm   Post subject: (No subject)

i get the same error, and i dont know why

but try declaring all variables at the beginning of the program, and structure your program a bit better...it makes it much easier to read and follow

HINT:hit f2 in turing after your done the program
Boarder16




PostPosted: Mon Dec 29, 2003 11:59 pm   Post subject: (No subject)

try using procedures too, i knwo usaid sorry for the form bein messy but its soo messy!!! lol, ahhhahhh i stopped reading it half way because its soo messy, or its just me and i'm a neat freak... Rolling Eyes
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  [ 6 Posts ]
Jump to:   


Style:  
Search: