ADD file via upload

main
pi5fnqcfr 2 years ago
parent b62ae30136
commit 5b7cf50cdc

@ -0,0 +1,39 @@
#include<iostream>
#include<string>
#include"book.h"
#include"library.h"
using std::cout;
using std::cin;
using std::endl;
extern Book booklist[50];
extern int num;
void wxy::SearchBook() {
char name[80];
char ch;
cin.get(ch);//Ïû»Ø³µ¼ü
for (;;) {
int g = 1;
cout << "which book do you wanna browse" << endl;
cin.getline(name, 80);
cin.clear();
for (int i{}; i < num; i++) {
if (strcmp(name, booklist[i].Name) == 0) {
g = 0;
cout << booklist[i].Name << endl << booklist[i].Auther << endl << booklist[i].amount << endl;
break;
}
}
if (g)
cout << "there is no such book" << endl;
cout << "wanna go on? press n to quit,press enter to continue" << endl;
cin.get(ch);
if (ch == 'n' || ch == 'N')
{
break;
}
}
}
Loading…
Cancel
Save