本文介绍了如何修复错误“声明语法错误”和“宣布失踪; &QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 有人请帮助我完成这个图书馆项目的工作,或者有人可以发送一个500行的图书馆管理程序。它必须像这个程序一样简单。它必须只包括struct,cout,cin,if,for和类似的东西。你知道我的意思ri8吗? 我尝试了什么: #include < iostream.h > #include < conio.h > #include < string.h > #include < stdio.h > 的#include < dos.h > 静态 int bookcount = 0 ; // ******************** ************************************************** **************************** // 此类包含与书籍相关的功能 // ************ ************** struct 预订 { int i,j; int bookcode [ 5 ]; char 名称[ 100 ] [ 50 ]; char 作者[ 100 ] [ 50 ]; int 数量[ 100 ],价格[ 100 ]; int issue [ 100 ]; Book() { i = j = 0 ; } public : void add_books(); void list_of_books(); void main(); void modify_books(); void delete_books(); void search_books(); void issue_books(); void return_books(); }; // ************ ************************************************** ****************** // 此类包含菜单中的功能 // ****** ************************************************** ************** // CLASS IS从书中保持并且有关系 // ******* ************************************************** *************************************** void introduction() { cout<< \ n \ nn \\\\\\\\\\\\\\\\\\\\\ cout<< \t\t图书馆管理程序预订\ n \\ nn \\\; cout<< \ t此计划的工具为:-\\\ ; cout<< \t\t\tMaintaining Books of books \ n \ N; cout<< \t \ t \这个程序可以保存记录(100 )书籍类别和存储10,000本书。\ n \\ n \\ n \\ n; cout<< \t\t让我们开始\ n ; cout<< \t\t按任意键继续....; } void Book :: main() { void main_menu() { clrscr(); int ch; cout<< \ n \ n \\\\\\\\\\\\\\\\\\\\\\\\\\\ ; cout<< \t\t ~~~~~~~~~~~ ~~~~ \\\\\\; cout<< \t\t\t1。简介\ n \\ nn ; cout<< \t\t\t2。查看图书清单\ nn \; cout<< \t\t\t3。添加图书\ n \ N; cout<< \t\t\t4。编辑菜单\ n \ N; cout<< \t\t\t5。搜索图书\ nn \ N; cout<< \t\t\t6。发行/退货书籍\ n \\\; cout<< \t\t\t.7。关闭应用程序\ n \ n\\\; cout<< \ n \\\\\\\\\\\\\\\\\\\\\\\\\ /跨度>; cin>> ch; switch (ch) { case 1 :引入(); break ; case 2 :list_of_books(); break ; case 3 :add_books(); break ; case 4 :edit_menu(); break ; case 5 :search_books(); break ; case 6 :issue_return(); break ; case 7 : { cout<< \ n \ n \\ n \ t \ t感谢您使用程序\ n; cout<< \t\t在3秒内退出....... \\ \\\\\\\; 延迟( 3000 ); getch(); } break ; 默认:cout<< \\ \\ t \\ t请再次输入您的选择!\ n; 延迟( 3000 ); main_menu(); } } void edit_menu() { clrscr(); int ch1; cout<< \ n \ n \\\\\\\\\\\\\\\\\\\\ ; cout<< \t\t ~~~~~~~~~~~ ~~~~~~ \\\\\\; cout<< \t\t\t1。修改\ n \\ n ; cout<< \t\t\t2。删除\ n \\ n ; cout<< \t\t\t3。主菜单\ n \ N; cout<< \t\t\t输入您的选择: ; cin>> ch1; switch (ch1) { case 1 :modify_books(); break ; case 2 :delete_books(); break ; case 3 :main_menu(); break ; 默认: { cout<< \t\t\t\t请再次输入您的选择!\ n; 延迟( 3000 ); edit_menu(); } } } void issue_return() { clrscr(); int ch2; cout<< \ n \ n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ N; cout<< \t\t ~~~~~~~~~~~ ~~~~~~~~~ \\\\\\; cout<< \t\t\t1。问题书籍\ n \ N; cout<< \t\t\t2。返回图书\ n \ N; cout<< \t\t\t3。主菜单\ n \ N; cout<< \t\t\t输入您的选择: ; cin>> ch2; switch (ch2) { case 1 :issue_books(); break ; case 2 :return_books(); break ; case 3 :main_menu(); break ; 默认: { cout<< \t\t\t请再次输入您的选择!\ n; 延迟( 3000 ); issue_return(); } } } } // ************ ************** // 定义CLASSBook中使用的功能 // ********* ************************************************** ** // 添加图书的功能 // ************************** ************* void Book :: add_books() { clrscr(); char choice; do { cout<< \ tADD BOOKS TO LIBRARY \\\; cout<< \ nNEW BOOK ENTRY ... \ n; cout<< \ n \ n输入5位数的图书代码:; for ( int i = 0 ; i< 6; i ++) cin>> bookcode [i]; cout<< 输入图书名称:; 得到(姓名[bookcount]); cout<< \ n输入作者姓名:; 得到(作者[bookcount]); cout<< \ n输入价格:; cin>>(价格[bookcount]); cout<< \ n输入数量:; cin>>(数量[bookcount]); cout<< \ n \\\nBOOK CREATED !!!!; bookcount ++; cout<< \ n \ n输入另一本书?(y / n):; cin>> choice; } while (choice == ' y' || choice == ' Y'); cout<< \ n按任意键返回主菜单... \ n ; getch(); } // *************** ****************************** // 显示图书清单的功能 // ********** void Book :: list_of_books() { clrscr(); cout<< 所有图书馆书籍的\tLIST; for (i = 0 ; i< bookcount; i ++) { cout<< \ n \ nnBook Code:; for ( int i = 0 ; i< 6; i ++) cin>> bookcode [i]; cout<< \ nBook名称:; puts(name [i]); cout<< \ nAuthor的名称:; puts(author [i]); cout<< \ nPrice:<< price [i] << ENDL; cout<< \ nQuantity:<< quantity [i] << ENDL<< ENDL; } if (i == 0 ) cout< < \ nNo Book Record.\\\\ n; cout<< \ n\ n按任意键返回主菜单... \\\; getch(); } // *************** ************************** // 修改图书的功能 // ** ****************************** void Book :: modify_books() { clrscr(); char choice; int bk_nmbr [ 5 ]; do { cout<< \tBOOK修改面板\ nn \ n; cout<< 输入要修改的5位数书籍代码:; for ( int i = 0 ; i< 6; i ++) cin>> bk_nmbr [i]; cout<< \ nSearching ... \ n; 延迟( 5000 ); for (i = 0 ; i< 6; i ++) { if (bk_nmbr [i] == bookcode [i]) { cout<< \ n \\ n,nBOOK RECORD FOUND !! \ n \ n; cout<< 添加修改详细信息\ n; cout<< 输入一个5位数的图书代码; for ( int i = 0 ; i< 5; i ++) cin>> bookcode [i]; cout<< \ nEntre Book of Book:; 得到(name [i]); cout<< \ n输入作者姓名:; 得到(作者[i]); cout<< \ n输入价格:; cin>>(price [i]); cout<< \ n输入数量:; cin>>(数量[i]); cout<< \ n \ nnBook with code<< bookcode [i]<< 已被修改... \ n; break ; } } 如果(i == bookcount) { cout<< \ n \ n找不到这样的图书记录。; } cout<< 修改另一本书?(y / n):; cin>> choice; } while (choice == ' y' || choice == ' Y'); cout<< 按任意键返回编辑菜单... ; getch(); } // ******* ***************************** // 删除图书的功能 // ************************************ void Book :: delete_books() { clrscr(); char choice; int bk_nmbr [ 5 ]; do { cout<< \tBOOK DELETING PANEL \ n \ n; cout<< 输入要删除的5位数书籍代码:; for ( int i = 0 ; i< 6; i ++) cin>> bk_nmbr [i]; cout<< \ nn搜寻......; 延迟( 5000 ); for (i = 0 ; i< 6; i ++) { if (bk_nmbr [i] == bookcode [i]) { cout<< \ n \\ n \\ n \\ n预订记录!!! \ n \ n; for ( int j = i; j< bookcount; j ++) { issue [j] = issue [j + 1]; bookcode [j] = bookcode [j + 1]; strcpy(name [j],name [j + 1]); strcpy(作者[j],作者[j + 1]); price [j] = price [j + 1]; 数量[j] =数量[j + 1]; } bookcount - = 1 ; cout<< \ n \ n \\ n \\ nnn记录删除成功... \ N; break ; } } 如果(i == bookcount) { cout<< \ n \ nn没有找到这样的书。; } cout<< 删除另一本书?(y / n):; cin>> choice; } while (choice == ' y' || choice == ' Y'); cout<< \ n按任意键返回编辑菜单...; getch(); } // *************** **************** // 搜索图书的功能 // ************ ******************* void Book :: search_books() { clrscr(); char choice; int bk_nmbr [ 5 ]; do { cout<< \tBOOK搜索面板\ n \\ n; cout<< 输入要搜索的5位数书籍代码:; for ( int i = 0 ; i< 6; i ++) cin>> bookcode [i]; cout<< \ nSearching ... \ n; for (i = 0 ; i< 6; i ++) { if (bk_nmbr [i] == bookcode [i]) { cout<< \ n\tBOOK RECORD FOUND !! \ n; cout<< 完整的书籍详细信息\ n; cout<< 图书代码:; cout<<(bookcode [i])<< endl; cout<< \ nBook名称:; puts(name [i]); cout<< \ nAnhor的名字:; puts(author [i]); cout<< \ nPrice:<< price [i] << ENDL; cout<< \ nQuantity:<< quantity [i] << ENDL; } } 如果(i == bookcount) { cout<< \ n \ nNo此类书籍记录已找到。; } cout<< \ n搜索另一本书?(y / n): ; cin>> choice; } while (choice == ' y' || choice == ' Y'); cout<< \ n按任意键返回主菜单......; getch(); } // *********** ************************* // 发行图书的功能 // *** ********************************* void Book :: issue_books() { clrscr(); char choice,choice1; int bk_nmbr [ 5 ]; do { cout<< \tBOOK发布面板\ nn \ n; cout<< 输入图书代码:; for ( int i = 0 ; i< 6; i ++) cin>> bk_nmbr [i]; cout<< \ nn搜寻......; 延迟( 5000 ); for (i = 0 ; i< 6; i ++) { if (bk_nmbr [i] == bookcode [i]) { cout<< \ n\tBOOK RECORD FOUNND !! \ n; cout<< 完整的书籍详细信息\ n; cout<< 图书代码:; cout<<(bookcode [i])<< endl; cout<< \ nBook名称:; puts(name [i]); cout<< \ nAnhor的名字:; puts(author [i]); cout<< \ nPrice:<< price [i] << ENDL; cout<< \ nQuantity:<< quantity [i] << ENDL; if (quantity [i]> 0) { cout<< \\\你想发行这本书吗?(是/否):; cin>> choice1; if (choice1 == ' y' || choice1 == ' Y') issue [i] = 1 ; 数量[i] - ; cout<< \ nBook with code<< bookcode [i ]<< 已发出\ n; } else { cout<< \ n这本书缺货了\ n; } break ; } } 如果(i == bookcount) { cout<< \ n \ n找不到这样的书籍记录。\ n; } cout<< \ n是否有另一本书?(是/否): ; cin>> choice; } while (choice == ' y' || choice == ' Y'); cout<< \ n按任意键返回发行/返回菜单..; } // *********** ********************************* // 返回图书的功能 // ************* void Book :: return_books() { char choice,choice1; int bk_nmbr [ 5 ]; do { cout<< \tBOOK RETURNING PANEL \ n \ n; cout<< 输入要返回的5位数簿号:; \t\tfor(int i=0;i<6;i++) \t\t\tcin>>bk_nmbr[i]; \t\tcout<<\"\nSearching...\n\"; \t\tdelay(5000); \t\tfor(i=0;i<6;i++) \t\t{ \t\t\tif(bk_nmbr[i]==bookcode[i]) \t\t\t{ \t\t\t\tcout<<\"\n\tBOOK RECORD FOUND!!\n\"; \t\t\t\tcout<<\"Complete Book Details\n\"; \t\t\t\tcout<<\"\nBook Code : \"; \t\t\t\tcout<<(bookcode[i])<<endl; \t\t\t\tcout<<\"\nBook Name : \"; \t\t\t\tputs(name[i]); \t\t\t\tcout<<\"\nAuthor's name : \"; \t\t\t\tputs(author[i]); \t\t\t\tcout<<\"\nPrice : \"<<price[i]<<endl; \t\t\t\tcout<<\"Quantity : \"<<quantity[i]<<endl; \t\t\t\tcout<<\"\nDo you want to return this book ? (y/n) : \"; \t\t\t\tcin>>choice1; \t\t\t\tif(choice1=='y' || choice1=='Y') \t\t\t\tissue[i]=0; \t\t\t\tquantity[i]++; \t\t\t\tcout<<\"\nBook with code \" <<bookcode[i]<<\" has been returned \n\"; \t\t\t\tbreak; \t\t\t} \t\t} \t\tif(i==bookcount) \t\t{ \t\t\tcout<<\"\n\nNo such book record is found.\n\"; \t\t} \t\tcout<<\"\nSearch another book ? (y/n) : \"; \t\tcin>>choice; \t} \twhile(choice=='y' || choice=='Y'); \tcout<<\"\nPress any key to go back to Issue/Return Menu...\"; \tgetch(); } 解决方案 This error is self-explanatory: declaration missing ; You need search your code for missing semicolon at the end of line. Please, read the error message to the end to find out which line causes such of error.Quote:void Book :: main() { void main_menu() { This is not valid C++ you cannot define a function inside another function definition (only lambdas are allowed). I suggest you to use a more updated compiler (and learn a bit more of OOP and modern C++).someone please help me with this library project work or could someone send a 500 lines library management program. it must be simple like this program. it must only include struct, cout, cin, if, for, and stuff like that. you know what I mean ri8?What I have tried:#include<iostream.h>#include<conio.h>#include<string.h>#include<stdio.h>#include<dos.h>static int bookcount=0;//**************************************************************************************************// THIS CLASS CONTAINS FUNCTIONS RELATED TO BOOKS//*************************************************************struct Book{int i, j;int bookcode[5];char name[100][50];char author[100][50];int quantity[100], price[100];int issue[100];Book(){i=j=0;}public:void add_books();void list_of_books();void main();void modify_books();void delete_books();void search_books();void issue_books();void return_books();};//********************************************************************************//THIS CLASS CONTAINS THE FUNCTIONS IN THE MENU//**********************************************************************//CLASS IS INHERITED FROM "Book" AND HAS A RELATION//************************************************************************************************void introduction(){cout<<"\n\n\n\t\t\t WELCOME TO OUR PROJECT\n";cout<<"\t\t LIBRARY MANAGEMENT PROGRAM FOR BOOKS\n\n\n";cout<<"\tThis Program has Facility of :-\n";cout<<"\t\t\tMaintaining Record of Books\n\n";cout<<"\t\t\tThis Program can Hold Record of hundered (100) Categories of Books and store 10,000 Books.\n\n\n";cout<<"\t\t Let's Get Started \n";cout<<"\t\t Press any key to continue....";}void Book :: main(){void main_menu(){clrscr();int ch;cout<<"\n\n\t\tMAIN MENU\n";cout<<"\t\t~~~~~~~~~~~~~~~\n\n";cout<<"\t\t\t1. Introduction\n\n";cout<<"\t\t\t2. View Book list\n\n";cout<<"\t\t\t3. Add Books\n\n";cout<<"\t\t\t4. Edit Menu\n\n";cout<<"\t\t\t5. Search Books\n\n";cout<<"\t\t\t6. Issue/ Return Books\n\n";cout<<"\t\t\t7. Close Application\n\n\n";cout<<"\n\t\t\tEnter Your Choice : ";cin>>ch;switch(ch){case 1:introduction();break;case 2:list_of_books();break;case 3:add_books();break;case 4:edit_menu();break;case 5:search_books();break;case 6:issue_return();break;case 7:{cout<<"\n\n\t\tThank You for Using the Program\n";cout<<"\t\tExiting in 3 seconds.......\n\n\n";delay(3000);getch();}break;default: cout<<"\t\t\tPlease Enter your choice again !\n";delay(3000);main_menu();}}void edit_menu(){clrscr();int ch1;cout<<"\n\n\t\tEDIT BOOKS\n";cout<<"\t\t~~~~~~~~~~~~~~~~~\n\n";cout<<"\t\t\t1. Modify\n\n";cout<<"\t\t\t2. Delete\n\n";cout<<"\t\t\t3. Main Menu\n\n";cout<<"\t\t\tEnter your choice : ";cin>>ch1;switch(ch1){case 1:modify_books();break;case 2:delete_books();break;case 3:main_menu();break;default:{cout<<"\t\t\t\tPlease enter your choice again !\n";delay(3000);edit_menu();}}}void issue_return(){clrscr();int ch2;cout<<"\n\n\t\tISSUE/ RETURN BOOKS\n";cout<<"\t\t~~~~~~~~~~~~~~~~~~~~\n\n";cout<<"\t\t\t1. Issue Books\n\n";cout<<"\t\t\t2. Return Books\n\n";cout<<"\t\t\t3. Main Menu\n\n";cout<<"\t\t\tEnter your choice : ";cin>>ch2;switch(ch2){case 1:issue_books();break;case 2:return_books();break;case 3:main_menu();break;default:{cout<<"\t\t\tPlease Enter your choice again! \n";delay(3000);issue_return();}}}}//************************************************************//DEFINITIONS OF FUNCTIONS USED IN CLASS "Book"//*************************************************************//Functions to Add Books//***************************************void Book::add_books(){clrscr();char choice;do{cout<<"\tADD BOOKS TO LIBRARY\n";cout<<"\nNEW BOOK ENTRY...\n";cout<<"\n\nEnter 5 digit Book Code : ";for(int i=0;i<6;i++)cin>>bookcode[i];cout<<"Enter Name of Book : ";gets(name[bookcount]);cout<<"\nEnter Author's Name : ";gets(author[bookcount]);cout<<"\nEnter Price : ";cin>>(price[bookcount]);cout<<"\nEnter Quantity : ";cin>>(quantity[bookcount]);cout<<"\n\nBOOK CREATED !!!!";bookcount++;cout<<"\n\nEnter Another Book ? (y/n) : ";cin>>choice;}while(choice=='y' || choice=='Y');cout<<"\nPress any key to go back to Main Menu...\n";getch();}//*********************************************// Function to Show Book List//*********************************************void Book::list_of_books(){clrscr();cout<<"\tLIST OF ALL LIBRARY BOOKS";for(i=0;i<bookcount;i++){cout<<"\n\nBook Code : ";for(int i=0;i<6;i++)cin>>bookcode[i];cout<<"\nBook Name:";puts(name[i]);cout<<"\nAuthor's Name : ";puts(author[i]);cout<<"\nPrice : "<<price[i]<<endl;cout<<"\nQuantity : "<<quantity[i]<<endl<<endl;}if(i==0)cout<<"\nNo Book Record.\n\n";cout<<"\n\nPress any key to go back to Main Menu...\n";getch();}//*****************************************//Function to modify books//********************************void Book::modify_books(){clrscr();char choice;int bk_nmbr[5];do{cout<<"\tBOOK MODIFYING PANEL\n\n";cout<<"Enter the 5 digit Book Code to modify : ";for(int i=0;i<6;i++)cin>>bk_nmbr[i];cout<<"\nSearching...\n";delay(5000);for(i=0;i<6;i++){if(bk_nmbr[i]==bookcode[i]){cout<<"\n\nBOOK RECORD FOUND!!\n\n";cout<<"Add Modifying Details\n";cout<<"Enter a 5 digit Book Code" ;for(int i=0;i<5;i++)cin>>bookcode[i];cout<<"\nEntre Name of Book : ";gets(name[i]);cout<<"\nEnter the Author's Name : ";gets(author[i]);cout<<"\nEnter Price : ";cin>>(price[i]);cout<<"\nEnter quantity : ";cin>>(quantity[i]);cout<<"\n\nBook with code " <<bookcode[i]<<" has been Modified...\n";break;}}if(i==bookcount){cout<<"\n\nNo such Book record is found.";}cout<<"Modify another book ? (y/n) : ";cin>>choice;}while(choice=='y' || choice=='Y');cout<<"Press any key to go back to Edit Menu...";getch();}//************************************//Function to delete books//************************************void Book::delete_books(){clrscr();char choice;int bk_nmbr[5];do{cout<<"\tBOOK DELETING PANEL\n\n";cout<<"Enter the 5 digit book code to be deleted : ";for(int i=0;i<6;i++)cin>>bk_nmbr[i];cout<<"\nSearching...";delay(5000);for(i=0;i<6;i++){if(bk_nmbr[i]==bookcode[i]){cout<<"\n\n\tBOOK RECORD FOUND !!!\n\n";for(int j=i;j<bookcount;j++){issue[j]=issue[j+1];bookcode[j]=bookcode[j+1];strcpy(name[j], name[j+1]);strcpy(author[j], author[j+1]);price[j]=price[j+1];quantity[j]=quantity[j+1];}bookcount-=1;cout<<"\n\n\nBook Record Deleted Succesfully...\n";break;}}if(i==bookcount){cout<<"\n\nNo such book found.";}cout<<"Delete another book ? (y/n) : ";cin>>choice;}while(choice=='y' || choice=='Y');cout<<"\nPress any key to go back to Edit Menu...";getch();}//*******************************//Function to search books//*******************************void Book::search_books(){clrscr();char choice;int bk_nmbr[5];do{cout<<"\tBOOK SEARCHING PANEL\n\n";cout<<"Enter the 5 digit Book Code to search : ";for(int i=0;i<6;i++)cin>>bookcode[i];cout<<"\nSearching...\n";for(i=0;i<6;i++){if(bk_nmbr[i]==bookcode[i]){cout<<"\n\tBOOK RECORD FOUND!!\n";cout<<"Complete Book Details\n";cout<<"Book Code : ";cout<<(bookcode[i])<<endl;cout<<"\nBook Name : ";puts(name[i]);cout<<"\nAuthor's name : ";puts(author[i]);cout<<"\nPrice : "<<price[i]<<endl;cout<<"\nQuantity : "<<quantity[i]<<endl;}}if(i==bookcount){cout<<"\n\nNo Such Book Record is Found.";}cout<<"\nSearch another book ? (y/n) : ";cin>>choice; } while(choice=='y' || choice=='Y'); cout<<"\nPress any key to go back to Main Menu..."; getch();}//************************************//Function to issue books//************************************void Book::issue_books(){clrscr();char choice, choice1;int bk_nmbr[5];do{cout<<"\tBOOK ISSUING PANEL\n\n";cout<<"Enter the Book Code : ";for(int i=0;i<6;i++)cin>>bk_nmbr[i];cout<<"\nSearching...";delay(5000);for(i=0;i<6;i++){if(bk_nmbr[i]==bookcode[i]){cout<<"\n\tBOOK RECORD FOUNND!!\n";cout<<"Complete Book Details\n";cout<<"Book Code : ";cout<<(bookcode[i])<<endl;cout<<"\nBook Name : ";puts(name[i]);cout<<"\nAuthor's name : ";puts(author[i]);cout<<"\nPrice : "<<price[i]<<endl;cout<<"\nQuantity : "<<quantity[i]<<endl;if(quantity[i]>0){cout<<"\nDo you want to issue this book ? (y/n) : ";cin>>choice1;if(choice1=='y' || choice1=='Y')issue[i]=1;quantity[i]--;cout<<"\nBook with code "<<bookcode[i]<<" is issued\n";}else{cout<<"\nThis book is out of stock\n";}break;}}if(i==bookcount){cout<<"\n\nNo such book record is found.\n";}cout<<"\nIssue another book? (y/n): ";cin>>choice;}while(choice=='y' || choice=='Y');cout<<"\nPress any key to go back to Issue/Return Menu..";}//********************************************//Function to return books//********************************************void Book::return_books(){char choice, choice1;int bk_nmbr[5];do{cout<<"\tBOOK RETURNING PANEL\n\n";cout<<"Enter the 5 digit Book Code to return : ";for(int i=0;i<6;i++)cin>>bk_nmbr[i];cout<<"\nSearching...\n";delay(5000);for(i=0;i<6;i++){if(bk_nmbr[i]==bookcode[i]){cout<<"\n\tBOOK RECORD FOUND!!\n";cout<<"Complete Book Details\n";cout<<"\nBook Code : ";cout<<(bookcode[i])<<endl;cout<<"\nBook Name : ";puts(name[i]);cout<<"\nAuthor's name : ";puts(author[i]);cout<<"\nPrice : "<<price[i]<<endl;cout<<"Quantity : "<<quantity[i]<<endl;cout<<"\nDo you want to return this book ? (y/n) : ";cin>>choice1;if(choice1=='y' || choice1=='Y')issue[i]=0;quantity[i]++;cout<<"\nBook with code " <<bookcode[i]<<" has been returned \n";break;}}if(i==bookcount){cout<<"\n\nNo such book record is found.\n";}cout<<"\nSearch another book ? (y/n) : ";cin>>choice;}while(choice=='y' || choice=='Y');cout<<"\nPress any key to go back to Issue/Return Menu...";getch();} 解决方案 This error is self-explanatory: declaration missing ;You need search your code for missing semicolon at the end of line.Please, read the error message to the end to find out which line causes such of error.Quote:void Book :: main(){ void main_menu() {This is not valid C++ you cannot define a function inside another function definition (only lambdas are allowed).I suggest you to use a more updated compiler (and learn a bit more of OOP and modern C++). 这篇关于如何修复错误“声明语法错误”和“宣布失踪; &QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-16 01:01