我的代码中出现声明语法错误,但我没有发现任何错误或任何错误。请帮助。我正在使用turbo c ++进行学校级编程。 我得到它我键入-void issue()(在主函数内)
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
class book {
char bookname[20];
char isbn[20];
char author[20];
char category[20];
float price;
int noc;
public:
void accept(){
cout<<"Enter book name :- \n";
gets(bookname);
cout<<"Enter isbn no of the book:- \n";
gets(isbn);
cout<<"Enter authour name:- \n";
gets(author);
cout<<"Enter category of book:- \n";
gets(category);
cout<<"Enter price of the book :- \n";
cin>>price;
cout<<"Enter no of copies of book available in the library :- \n";
cin>>noc;
}
void display() {
cout<<"Name of the book is :- ";puts(bookname);cout<<endl;
cout<<"ISBN :- ";puts(isbn);cout<<endl;
cout<<"Author :- ";puts(author);cout<<endl;
cout<<"Category :- ";puts(category);cout<<endl;
cout<<"Price :- ";cout<<price<<endl;
cout<<"No of copies available :- ";cout<<noc<<endl;
}
void issue();
}b[5];
int main() {
for(int i=0;i<5;++i) {
b[i].accept();
}
void issue() {
int flag=1;
char booksearch[20];
cout<<"Enter name of book member wants to issue :- \n";
gets(booksearch);
for(int i=0;i<5;++i) {
flag=strcmp(booksearch,b[i].bookname);
if(flag==0)
break;
}
if(flag==0) {
cout<<"Book found \n";
b[i].display();
b[i].issue();
} else {
cout<<"Book not available:- \n";
}
}
getch();
return 0;
}
答案 0 :(得分:1)
main
没有结束括号在void issue()
void issue()
更改为void book::issue()
修复此问题,然后告诉我们任何进一步的错误以及它出现在
上的行修改强>
而不是1)移动
getch();
return 0;
}
到那个地方