Hi all, hope you are well.
There was another thread asking this question along with another, but this question was never answered. Here is my code - incomplete - hopefully i can explain my problem!
<code>
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define MAX 10
char choice;
char type;
int i;
// The base class.
class books {
public:
struct database {
char title[256];
char author[256];
int isbn[11];
char publishername[256];
char cdrom[4];
int yearofpub[5];
float price[5];
}np[MAX]; // end of struct
//..........................
void find(void);
void enter(int);
void remove(void);
void first(void);
};//end of telephone class
//------------------------------------
// derived class goes here.
class store: public books{
public:
void save(void);
void load(void);
};//end of derived store class.
char name[12]="peter minns";
//------------------------------------
int main(void) {
books bdata;
store storage;
storage.first();
cout<<"sagfafs";
return(0);
}
//------------------------------------
void books::first(void) {
cout<<"******************************************* ****************\n";
cout<<"******************************************* ****************\n";
cout<<"*****************Welcome to the Book***********************\n";
cout<<"***********************Database************ ****************\n";
cout<<"******************************************* ****************\n";
cout<<"******************************************* ****************\n\n\n\n";
cout<<" What would you like to do? \n";
cout<<" Select:\n\n";
cout<<" A To add a book to the database\n";
cout<<" F To search for a book\n";
cout<<" R To remove a book\n";
choice=getchar();
choice=toupper(choice);
switch(choice) {
case 'A': {
cout<<"you selected 'Add'\n";
cout<<" enter the title of the book";
cin.gets(np[i].title);
break;}
case 'F': {
cout<<"you selected 'Search'\n";
break;}
case 'R': {
cout<<"you selected 'Remove'\n";
break;}
}
}
//---------------------------------------
void books::enter(int i) {
cout<<"hi";
}
</code>
sorry if its not set out too well.
Basically from within the switch menu i want to call member functions (i havent written them yet). The one i have been trying to get to work is the Add option. When they select that option i want to link to void books::enter(int).
I am still finding my programming feet at the moment so any help would be appreciated.
Cheers in advance;
Andy