
-----------------------------------
the_scott_mans
Tue Apr 01, 2003 2:17 pm

true statement
-----------------------------------
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

-----------------------------------
the_scott_mans
Tue Apr 01, 2003 3:14 pm


-----------------------------------
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
Tue Apr 01, 2003 5:00 pm


-----------------------------------
you're probably refering to boolean variable. It is used like a flag to mark stuff. For example:


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


-----------------------------------
the_scott_mans
Tue Apr 01, 2003 5:44 pm


-----------------------------------
thanks that helps but how does it work with a list.

like all the items are numbered and you select the numbers then press done and it adds the tax and price of each selection.

-----------------------------------
Tony
Tue Apr 01, 2003 5:52 pm


-----------------------------------
make another array of boolean type with a coresponding numbers.

such as

tax(1) would keep true/false value about item(1)

-----------------------------------
the_scott_mans
Tue Apr 01, 2003 6:18 pm


-----------------------------------
so would i just put

if choice = "1" then
choice := true
else
choice := false
end if

if choice = "2" then
choice := true
else
choice := false
end if

etc.

and then

if choice = true then 
put total+total*0.15  
end if 

or how would i get the computer to record all the prices then add them up
