Code:
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <conio.h>
#define MAX 20
int s;
char choice;
class book {
public:
struct detail {
char name;
char authors;
char ISBN[10];
char publisher;
char cdrom[3];
char year[4];
char price;
}np[MAX];
void enter(int);
void open(int);
};
class savei: public book{
public:
void save(void);
void load(void);
};
int main(int){
book dbase;
savei savey;
book.open(i);
return(0);
};
void book::open(int) {
system("cls");
cout << " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
cout << " l l\n";
cout << " l Welcome to the database l\n";
cout << " l l\n";
cout << " l These are the options... l\n";
cout << " l l\n";
cout << " l A Find a book l\n";
cout << " l B Find an author l\n";
cout << " l C Find a publisher l\n";
cout << " l D Find a year l\n";
cout << " l E Look at CD-ROMS l\n";
cout << " l F Add a New Book l\n";
cout << " l G Delete a Record l\n";
cout << " l H Find Total Cost l\n";
cout << " l I Save Database l\n";
cout << " l J Load Database l\n";
cout << " l l\n";
cout << " l l\n";
cout << " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
choice=getchar();
choice=toupper(choice);
switch(choice) {
case 'A': {
cout<<"You selected find a book\n";
cout<<" Please enter the name of the book";
break;}
case 'B': {
cout<<"You selected find an Author\n";
break;}
case 'C': {
cout<<"You selected find a publisher\n";
break;}
case 'D': {
cout<<"You selected to find a Year\n";
break;}
case 'E': {
cout<<"You selected To find books with CDROMS\n";
break;}
case 'F': {
cout<<"You Want to add a new book\n";
// book.enter(s);
break;}
case 'G': {
cout<<"You Want to remove a book\n";
break;}
case 'H': {
cout<<"Find the total cost of the books\n";
break;}
case 'I': {
cout<<"Saving the database.....\n";
break;}
case 'J': {
cout<<"Loading the database.....\n";
break;}
case 'X': {
cout<<"back to the main menu\n";
;}
break;}
}
void book::enter(int s) {
cout<<"Please Enter the name of the book\n";
cin>>(np[s].name);
cout<<"Please enter the name of the author\n";
cin>>(np[s].authors);
cout<<"Please enter the ISBN number\n";
cin>>(np[s].ISBN);
cout<<"Please enter publisher name\n";
cin>>(np[s].publisher);
cout<<"Please indicate if it has a CDROM attached, Yes or No \n";
cin>>(np[s].cdrom);
cout<<"Please enter the publishing year\n";
cin>>(np[s].year);
cout<<"Please enter the price of the book\n";
cin>>(np[s].price);
}
Hello i have an error that i can see for the life of me!
im getting a parse error before line 41 and i cant see where!
will be grateful for anyone who can see it!
thanks!