rpg inventory

I want to create an inventory system that keeps track of the amount of each item you have and are able to scroll through each one and selecting which ever item will activate it. I’m unsure what exactly to use to accomplish this. Should I use an array of items that keeps track of the item name and how many of each you have? Also I don’t know how to make it so when you scroll through that the system can keep track of which item you are on by displaying an arrow next to it and then tell if it has been selected. Once selected I am also unsure of how to activate a certain function from that array. So here’s an example of how it would look ingame.

Inventory 

> potion1 [ 1 ]
  potion2 [ 0 ]
  potion3 [ 5 ]

The structure of your program will be a little more complex than using an array. You will best use some object oriented concepts. Read them up if you do not know about them.

The way I would design the inventory system:
Have an inventory class with a list of inventory items. Inventory items are again a class which consists of a pointer to an inventory object (your potions in this case) and a counter.

You will also need to implement some kind of GUI in the inventory class with a cursor through which you can activate your inventory item and decrement the counter.