A simple stocktaking console program written in C++. You can edit your database to reflect your assets, by adding, removing and editing products in the console.


The menu instructions are:

The existing stock.txt is loaded when the program starts. You can see it by typing inv.

read and write load and save stock.txt respectively.

new provides a series of prompts to determine the id, name, price and quantity of the new product. These must be number, word, number, number. Quantity can be negative to allow for money out as well as in.

delete prompts for an id, and deletes all products with this id.

edit prompts for an id, column (1,2,3,4) and new value, and replaces the referenced cell's value with the new value.

exit exits the program.

Technical info

The code is type-safe in that integer fields only accept integers, but the code is easy to crash.

However, the database is easy to restore! The database is stored in stock.txt which must be in the same folder as stocktaker.exe. You can store different databases in different folders with their own copy of stocktaker.exe.

stock.txt can be independently edited in notepad.

Each new line of text must be in this exact form:


Only 'qty' can be negative. The code returns 'monies' as the sum of price*qty, and so returns a valuation of assets.


  • StockTaker