For the past couple weeks I've been writing a helpful program that keeps track of all of the electonic parts I have and I keep adding features so the program is getting much larger then anything else I've written. So are there general rules or guidelines on when to add a function or when to add a header file instead? I feel I'm not being very consistent or that maybe I'm adding to many header files.
Thanks in advance.
The general rule of thumb is one header file per class. Adding a function should be done when you need new functionality or if you find that an existing function can be split into several self-contained tasks - in that case you should add additional functions that perform these smaller tasks.
For instance, my Main function reads in text files to store values in arrays and prints out a menu of options. One of these options outputs a table of electronic parts (like resistors, capacitors, etc.) and how many of them I currently have in stock. It gets the values from the text files it initially read in.
When I choose this option from the main menu, should it be a seperate function in the .cpp file or should it be in a .h file?
That is what I am trying to ask.