i really need help with how to add up all the selections with the true statement. I am makeing a cash register and i was told to use the true statement thing well i was wondering what it is that i need to put for the true statement to get it to add up all of the selected true statements
Sponsor Sponsor
the_scott_mans
Posted: Tue Apr 01, 2003 3:14 pm Post subject: (No subject)
i am also wondering how i can make it reconize a selection i have it laid out in list form, numbered, and indented. When i use the if statement it does not reconize it.
Tony
Posted: Tue Apr 01, 2003 5:00 pm Post subject: (No subject)
you're probably refering to boolean variable. It is used like a flag to mark stuff. For example:
code:
var total:int %counter
var price:int %variable
var word:string
var tax:boolean %true/false flag for tax
loop
put "enter price"
get price
total := total + price
exit when price =0
end loop
put "add tax? y/n"
get word
if word="y" then
tax := true
else
tax := false
end if
%now you can use that "tax" variable to check what the user selected from before
if tax=true then
put total+total*0.15
else
put total
end if