Thread: unknown error!

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    16

    Question unknown error!

    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!

  2. #2
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    Code:
    int main(int) <--- ??? int main(int argc, char *argv[])
    {
        book dbase;
        savei savey;
        book.open(i); <---  Shouldn't it be dbase.open() ???
        
        return(0);
    }
    And i is undeclared in main().

  3. #3
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    int main(int){

    you can't have a function parameter just declared as int, you have to give it a name, like int i, which I believe is what you intended? because you use the variable i in book.open(i); later.

    -edit-
    bah, beat me to it, and fixed other stuff too...........i tried *starts weeping*

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    16
    i have to be blind

    cheers people! now to get the rest talking.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  5. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM