I created a customer class for a database program and want to store the objects somewhere. what would be the best method to do this? every time the user pushes "n" it generates a new customer object like this
void menuFunction::newOption()
{
int IDnumberFile, IDnumber;
fstream IDfile;
the customer class looks like this
class Customer
{
public:
int IDnumberNUM;
void capitalize();
void newPawn();
void newPawnFirearm();
void newPawnJewelry();
void newPawnOther();
int fileCustomer();
void display();
void color(char);
void raceF(char);
void genderF(char);
void search();
Customer();
friend class menuFunction;
the ultimate goal is to have a database for a pawn shop that adds a customer to a database and gives the user the ability to add items they pawn or sell. the list should also be in alphabetical order. any suggestions??
should the tables, database tables(files), be normalized :-) ?
If so then you may need many files(tables), I would use many files, not just one, and normalize the data, using references( foreign keys). But it is a matter of personal choice and taste. I would not sort the data and then write them into the tables(files). It should be the job of reader/getter to sort the data in any order.