Computer Science Canada TURING PROB PLZ HELP |
Author: | help_wanted [ Thu Jan 08, 2004 7:18 pm ] |
Post subject: | TURING PROB PLZ HELP |
CAN SOME ONE HELP ME PLEASE IT KEEPS SAYING THIS IS THE PROGRAM I WROTE AND WHEN I TRY TO RUN IT, IT SAYS: operands of + must be both interger or real, compatible sets, or strings const rn:="Prashanna" const rp:="063" var num1:int var num2:int var num4:int var num3:int var num5:real var num6:real var num01:="500" var n:string var p:string var count:=0 var win:=Window.Open("position:top,center,graphics:500;400") proc userLogin loop put "What is your Account name?" get n if n=rn then put " " return else put "Please try again" count +=1 end if if count=3 then loop Window.Close(win) end loop end if end loop end userLogin proc userPwd loop put "Now enter your password" get p if p=rp then put "Password Correct" return else put "Please try again" count +=1 end if if count=3 then loop Window.Close(win) end loop end if end loop end userPwd userLogin userPwd cls put "Your balance is $500" put "******************************************************" put " ***Welcome to Thistletown Banking*** " put " 1. Make a Deposit" put " 2. Make a Withdrawal" put " 3. View Balance" put " 4. Exit the Program" put "******************************************************" put "Enter the number that you would like to do ".. get num1 cls if num1 = 1 then put "How much would you like to deposit $".. get num5 delay (1000)cls put "Your balance now is $", num01 + num5 end if delay (2000)cls put "******************************************************" put " ***Welcome to Thistletown Banking*** " put " 1. Make a Deposit" put " 2. Make a Withdrawal" put " 3. View Balance" put " 4. Exit the Program" put "******************************************************" put "Enter the number that you would like to do ".. get num2 if num2 = 2 then put "How much would you like to withdraw? ".. get num6 put "Your Balance now is ", num01 + num5 - num6 end if if num6 < (num01 + num5) then put "You exceeded your balance please try put in another amount" end if delay (2000) cls put "******************************************************" put " ***Welcome to Thistletown Banking*** " put " 1. Make a Deposit" put " 2. Make a Withdrawal" put " 3. View Balance" put " 4. Exit the Program" put "******************************************************" put "Enter the number that you would like to do ".. get num3 if num3 = 3 then put num01 + num5 - num6 end if delay (1500)cls put "******************************************************" put " ***Welcome to Thistletown Banking*** " put " 1. Make a Deposit" put " 2. Make a Withdrawal" put " 3. View Balance" put " 4. Exit the Program" put "******************************************************" put "Enter the number you would like to do ".. get num4 if num4 = 4 then put "Thank you for using Thistletown Banking" delay (1000) Window.Close(win) end if |
Author: | Boarder16 [ Thu Jan 08, 2004 7:30 pm ] |
Post subject: | |
dude what r u trying to do... put 500 + num5 or make it so it shows teh total of what that equals???? |
Author: | Mazer [ Thu Jan 08, 2004 7:44 pm ] | ||||
Post subject: | |||||
the problem is that you're trying to add a number to a string. num01 = "500" <-- a string, a "word" num5 <-- a real, a "number" either take off the quotation marks on 500 to make it an integer, or change
to
|
Author: | Boarder16 [ Thu Jan 08, 2004 7:50 pm ] | ||
Post subject: | |||
here you go... i changed quite a bit.. its all commented why and how bellow... it runs fine now.. teh simple problem was that u were trying to add a real numebr to an integer.. or sumthing liek that....
It wasn't that hard 4 me 8) , i am a genius.. its alot shorter and better.. u can add to it more.. P.S when the program is complete...post it 4 me to see ok... i'l lbe expecting good things from it lol... |
Author: | Mazer [ Thu Jan 08, 2004 7:58 pm ] |
Post subject: | |
holy crap, i'm going insane. when i first read help_wanted's program i thought it said "Welcome to Thistletown Bowling", and then when i read your program i noticed a proc about passwords and i just thought you posted in the wrong forum! ![]() ![]() ![]() |
Author: | Andy [ Fri Jan 09, 2004 9:24 pm ] |
Post subject: | |
and change ur topic name |