
-----------------------------------
help_wanted
Thu Jan 08, 2004 7:18 pm

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

-----------------------------------
Boarder16
Thu Jan 08, 2004 7:30 pm


-----------------------------------
dude what r  u trying to do... put 500 + num5 or make it so it shows teh total of what that equals????

-----------------------------------
Mazer
Thu Jan 08, 2004 7:44 pm


-----------------------------------
the problem is that you're trying to add a  number to a string.
num01 = "500" IT SHOULD ALWAYS BE LIKE THIS....
        put "How much would you like to deposit $" ..
        get num5
        delay (1000)
        cls
        put "Your balance now is $", num01 + num5
        balance := num01 + num5 %Balance gets balue
        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 " ..
    elsif num1 = 2 then
        put "How much would you like to withdraw? " ..
        get num6
        balance := num01 + num5 - num6 %Balance gets balue
        if num6 > (num01 + num5) then
            put "You exceeded your balance please try put in another amount"
        else
            put "Your Balance now is ", num01 + num5 - num6 % your greater then sign was the wrong way here lol
        end if
        /*Also you had it so that no matter what tehy did it would add to their balance...now
         only does if they ACTUALY HAVE the money they want*/
        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 " ..
    elsif num1 = 3 then
        put balance %Displayes variable
        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 " ..
    elsif num1 = 4 then
        put "Thank you for using Thistletown Banking"
        delay (1000)
        Window.Close (win)
    end if
end loop
/*try to rememebr in the future that an optiosn menu like this should all be in one big if statement.. and
loop if it is always being used, seperate variables for each new action is a waste of time, and complicates
things, i take it you are new..so it is a VERY good start..*/

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...

-----------------------------------
Mazer
Thu Jan 08, 2004 7:58 pm


-----------------------------------
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!  :oops:  :P  :roll:

-----------------------------------
Andy
Fri Jan 09, 2004 9:24 pm


-----------------------------------
and change ur topic name
