type item :
record
name, cost, damage_mod : int
end record
var items : array 1 .. 3 of item
items (1).name := "Shiv"
items (1).cost := 25
items (1).damage_mod := +1
items (2).name := "Shank"
items (2).cost := 75
items (2).damage_mod := +2
items (3).name := "Laser Rifle"
items (3).cost := 100
items (3).damage_mod := +3
put "What do you want to buy?"
for i : 1 .. upper (items)
put i, ") ", items (i).name, " costs ", items (i).cost, ": dmg ", items (i).damage_mod
end for
get item_selection
money -= items (item_selection).cost % Same as money := money + items (item_selection)
dmg += items (item_selection).damage_mod
|