unexpected end of file error

class book
{ private: int price;char name[50];char pub[50];char author[50];

public:
void input()
{
//geting values

}
void search(book a,book b,book c,book d,book e)
{
book f;
char B[50];
cout<<"Enter book name to be searched"<<endl;
cin>>B;
// condition of logic
return f;
}

int main()
{
book b1,book b2, book b3, book b4, book b5, book b6;
//calling funtions
b6=b6.search(b1,b2,b3,b4,b5)

b6.output();
getch();
return o;
}



Error executing cl.exe.

proj.exe - 1 error(s), 0 warning(s)
Last edited on
You forgot to close the class book with a }
Try this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class book
{ private: int price;char name[50];char pub[50];char author[50];

public:
void input()
{
//geting values

}
void search(book a,book b,book c,book d,book e)
{
book f;
char B[50];
cout<<"Enter book name to be searched"<<endl;
cin>>B;
// condition of logic
return f;
}
}
int main()
{
book b1,book b2, book b3, book b4, book b5, book b6;
//calling funtions	
b6=b6.search(b1,b2,b3,b4,b5)

b6.output();
getch();
return o;
}


See I used the code tag by pressing the <> icon when I put code.
when i put } at end of class my program gives 18 errors
You had quite a large number of errors. I got it up to here, but you need to declare variable 'o' and add a definition for the output method in the book class, before this will work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

class book
{ private: int price;char name[50];char pub[50];char author[50];

public:
void input()
{
//geting values

}

book search(book a,book b,book c,book d,book e)
{
book f;
char B[50];
cout<<"Enter book name to be searched"<<endl;
cin>>B;
// condition of logic
return f;
}
};

int main()
{
book b1, b2,  b3,  b4,  b5,  b6;
//calling funtions	
b6=b6.search(b1,b2,b3,b4,b5);

b6.output();
getch();
return o;
}
So progress then.
Going to point out a few of the things I see that would give you errors,
first of, close classes with }; not } (note that this is only for classes and nothing else (other than maybe structs and similar)).

Secondly
book b1,book b2, book b3, book b4, book b5, book b6;
either change all your commas ',' to semicolons ';' or a more simple solution remove book at every point other than the beginning.

If you're getting more errors post them.

EDIT:
Ninja'd, damn forums not showing recent posts some times
Last edited on
oh thanks to both of you i have removed all those errors and my program is running now
Topic archived. No new replies allowed.