In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The editor of this article introduces in detail "the method of realizing the simple version of the library management system by C++". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "the method of C++ to realize the simple version of the library management system" can help you solve your doubts. Let's follow the editor's train of thought to learn new knowledge.
Including the administrator side and the student side, you can borrow and return books, and you can also change the login password of your account.
# header file to be used by include#include#include#include#include#include#include#include#include#include#include#include//stringstream # define STUDENT_FILE "student_text.txt" # define BOOK_FILE "book_text.txt" # define CLASS_FILE "class.txt" # define MAX 1000#define MIN 100using namespace std;class Student;class Book;class Clazz;void initialize (); / / initialize void Manager_Menu (); void Student_Menu (); void existSystem () / / exit the library management system void show_book_base (); string input_password (); / / enter the invisible password int student_id_exist (int id); / / find whether the user has int manager_id_exist (int id); int book_id_exist (int id); / / find whether the book exists int class_id_exist (int id); int random_id (); / / generate a random book number void book_find (); void load_information () Void update_information (); void regist_windows (); void regist_manager (); void regist_student (); bool student_cmp (Student a, Student b); bool class_cmp (Clazz a, Clazz b); bool book_cmp (Book a, Book b); class Book {int book_id; / / Book number string book_name; / / Book title int book_total_num / / Total number of such books string book_author; / / Book author string book_type; / / Book classification string book_present; / / Book introduction int book_student_len; / / how many people choose int student_ id [min] for each type of book / / the student number string student_ name [min]; / / the name of the student who borrowed the book public: Book () {book_id =-1; book_total_num = 0; book_student_len = 0; book_type = "; book_present ="; memset (student_id, 0, MIN); for (int I = 0) I
< MIN; i++) { student_name[i] = ""; } } void set_book_name(string book_name) { this->Book_name = book_name;} void set_book_author (string book_author) {this- > book_author = book_author;} void set_book_type (string book_type) {this- > book_type = book_type;} void set_book_total_num (int book_total_num) {this- > book_total_num = book_total_num } void set_book_id (int book_id) {this- > book_id = book_id;} int get_book_id () {return book_id;} void set_book_information (int book_id, string book_name, int book_total_num, string book_author, string book_type) {set_book_id (book_id); set_book_name (book_name) Set_book_author (book_author); set_book_type (book_type); set_book_total_num (book_total_num); / / set_book_present (book_present);} void set_book_present (string book_present) {this- > book_present = book_present;} string& get_book_present () {return book_present } void show_book_information (); friend int book_id_exist (int id); friend void show_book_base (); friend class Student; friend class Manager; friend void initialize (); friend void load_information (); friend void update_information ();}; Book book [MAX]; int book_len = 0 int book_len class User {protected: int id; string name; string password; int mark Public: User () {id =-1; mark = 0; name = ""; password = "";} void password_update (); virtual void book_insert () = 0; virtual void book_delete () = 0; friend void initialize (); void set_id (int id) {this- > id = id } void set_name (string name) {this- > name = name;} void set_mark (int mark) {this- > mark = mark;} void set_password (string password) {this- > password = password;} int get_id () {return id;} int get_mark () {return this- > mark } string get_name () {return name;} string get_password () {return password;}}; class Student:public User {int student_grade; / / School year-Total number of books borrowed by grade int class_id; string student_gender; int student_book_len;// public: Student () {id =-1 / / if id is-1, the account is invalid class_id =-1; name = ""; student_gender = ""; student_grade =-1; student_book_len = 0;} Student operator = (const Student& p); void set_class_id (int id) {class_id = id } void set_student_grade (int student_grade) {this- > student_grade = student_grade;} void set_student_gender (string student_gender) {this- > student_gender = student_gender;} int get_class_id () {return class_id;} int get_student_grade () {return student_grade } string get_student_gender () {return student_gender;} / / Student void book_insert (); void student_information_view (); void book_delete (); void student_information_update (); / / Student modify account password void show_self (); void student_windows (); friend void eroll_windows (); friend class Manager Friend void load_information (); friend void update_information (); friend bool student_cmp (Student aForce Student b);}; Student student [MAX]; int student_len = 0 public class Manager: public User {public: Manager () {id =-1; mark = 0; name = "; password =";} Manager (int id,int mark,string name,string password) {this- > id = id This- > mark = mark; this- > name = name; this- > password = password;} Manager operator = (const Manager& p); / / administrator's management of student account void student_insert (); void student_delete (); void student_view (); / / administrator's management of books void book_insert (); void book_delete (); void book_view () Void book_update (); / / Class void class_insert (); void class_update (); void class_view (); void class_delete (); void manager_windows (); void manager_insert (); friend void load_information (); friend void update_information ();}; Manager manager [MIN]; int manager_len = 0 Manager manager class Clazz {int class_id; string class_name; string teacher_name Int student_len;public: Clazz () {class_id =-1; class_name = ""; teacher_name = ""; student_len = 0;} int get_class_id () {return class_id;} string get_class_name () {return class_name } string get_teacher_name () {return teacher_name;} void set_class_id (int id) {this- > class_id = id;} void set_class_name (string name) {this- > class_name = name;} void set_teacher_name (string name) {this- > teacher_name = name } friend int class_id_exist (int id); friend void load_information (); friend void update_information ();}; Clazz clazz [MIN]; int class_len = 0; int main () {initialize (); / / Log in to regist_windows (); system ("pause"); return 0;} void initialize () {system ("title Library Information Management system"); system ("color f0") System ("mode con cols=90 lines=38"); srand ((int) time (0)); load_information (); Manager p1; p1.set_id (111111); p1.set_name ("Zhang Hui"); p1.set_password ("111111"); manager [0] = p1; manager_len++; Manager p2 (222222p1, "Li Si", "222222"); manager [1] = p2; manager_len++;} void Manager_Menu () {cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.