#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..