Don't know what the error is

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void EnterDetails();
void DisplayDetails(BOOK);
void SearchByBno();
void SearchByBname();

struct BOOK
{
	int Bno;
	char Bname[20];
	char Author[20];
	float Price;
}
void main()
{
	clrscr();
	BOOK A;
	EnterDetails();
	DisplayDetails(A);
	SearchByBno();
	SearchByBname();
	getch();
}

void EnterDetails()
{
	int n;
	cout<<"Enter the number of different books you would be entering: ";
	cin>>n;
	for(int i=0; i<n; i++)
	{
		cout<<"Enter the details of Book"<<i+1<<":"<<endl;
		for(int j=0; j<n; j++)
		{
			cout<<"Enter book number: ";
			cin>>A.Bno;
			cout<<"Enter book name: ";
			gets(A.Bname);
			cout<<"Enter Author of the book: ";
			gets(A.Author);
			cout<<"Enter price of the book in $: ";
			cin>>A.Price;
		}
	}
}
void DisplayDetails(BOOK A)
{
	int n;
	for(int i=0; i<n; i++)
	{
		cout<<"Details of book "<<i+1<<" "<<"are: "<<endl;
		for(int j=0; j<n; j++)
		{
			cout<<"Book number: ";
			cout<<A.Bno;
			cout<<"Book name: ";
			cout<<A.Bname;
			cout<<"Author: ";
			cout<<A.Author;
			cout<<"Price: ";
			cout<<A.Price;
		}
	}
}

void SearchByBno()
{
	BOOK A;
	cout<<"Enter book number of the book you are looking for: ";
	cin>>A.Bno;
	cout<<"The details of the book you are looking for are: ";
	cout<<"Book number: ";
	cout<<A.Bno;
	cout<<"Book name: ";
	cout<<A.Bname;
	cout<<"Author: ";
	cout<<A.Author;
	cout<<"Price: ";
	cout<<A.Price;
}

void SearchByBname()
{
	BOOK A;
	cout<<"Enter the name of the book you are looking for: ";
	gets(A.Bname);
	cout<<"The details of the book you are looking for are: ";
	cout<<"Book number: ";
	cout<<A.Bno;
	cout<<"Book name: "<<A.Bname;
	cout<<"Author: "<<A.Author;
	cout<<"Price: "<<A.Price;
}

The compiler gives the errors:
Line 5: Style of function definition is now obsolete.
Line 5: Declaration was expected.
Line 6: "SearchByBno" is not a parameter.
Line 7: "SearchByName" is not a parameter.
Line 16: Too many types in declaration.
Line 17: "main" is not a parameter.
Line 17: , expected.

I don't know what to do for 5(Both),17(last one)..for 6 and 7 I don't understand that how can they be parameters as it is clearly visible they are names of the respective functions? Same goes for 17..Need help..
Start from top:
5: void DisplayDetails(BOOK);
Line 5: Style of function definition is now obsolete.
Line 5: Declaration was expected.

What is BOOK? The compiler has not seen such identifier yet. If you move this line to after the definition of struct BOOK, the compiler will know.

Line 16: Too many types in declaration.

Line 15 has only a }. Add ;. Definitions of structs and classes need it.
Hmm thanks :D
Topic archived. No new replies allowed.