pseudocode

I am having trouble thinking of a way to structure this program.
I have 10+ items in stock.
I want to prompt the user how many of each he should have.
I then want to subtract by however many the user wishes.
The information must be retained when restarting the program.

i know i am going to need to get into file handling.
However, is this were inheritance comes into play in classes. Having so many items, is it best to have each item in a derived class? I do not really know the direction to go with this. Should i just start coding? will it all make sense lol...

closed account (48T7M4Gy)
Classes are possible but you are still left with the problem of managing the stock levels. So possibility is structs. Look carefully at the attributes you want.

have a plan, it's better than doing the coding without one. :)
Last edited on
So i need to allocate memory for an array of the number of items correct?
I will ask the user for number of items and each item name for the first run of the program. I am still confused on where the array would come into play.
closed account (48T7M4Gy)
Well, If you know how many items and they stay the same, ie the array is a constant and known size then you don't.
Last edited on
So storing the number in a text file is enough. I don't believe I need an array.
I will just store the name along with the integer and manipulate each every time I need to from there.

I eventually would like to add gui to this.
closed account (48T7M4Gy)
So storing the number in a text file is enough.
Go for it. There's nothing wrong with persistent memory.
Last edited on
Topic archived. No new replies allowed.