Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Some quick help...
Author Message
HKYPLAYA4LIFE

Posted: 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.
(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

Posted: 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
Thuged_Out_G

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

The variables func and one havent even been declared

yes they have

Posted: 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 )
Thuged_Out_G

Posted: 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

Posted: 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...
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 6 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: