Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A Code example of realizing Book Management system on C++

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains the "C++ implementation of the book management system code example", the article explains the content is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "C++ to achieve the book management system code example" it!

With nothing to do, I made a book management system with C++, which mainly has the functions of borrowing books, returning books, book management, user management and so on. The main technologies used are containers and files, as well as class encapsulation.

# include # include using namespace std;class Mybook;class Book; class Book {public: int id; / / Book number char book_name [20]; / / Book title int state; / / Book status char place [20]; / / Book location char stu_number [20]; / / Student number char stu_name [20]; / / Student name public: Book () Friend class Mybook;}; class User {public: char stu_number [20]; / / Student ID char stu_name [20]; / / Student name public: User () {strcpy (stu_number, "000"); strcpy (stu_name, "0");} friend class Mybook;}; class Mybook {private: list link_book; / / Save Book Information list link_user / / Save user information public: int main_menu (); / / main menu void getmenu (); / / get menu int menu (); / / Library management menu void getchoice (); / / enter and select void add_book (); / / add book void display_book (); / / display book information void del_book () / / Delete book information void search_book (); / / search book information void update_book (); / modify book information void borrow_book (); / / borrow book void return_book (); / / return book int menu_user (); / / manage user menu void add_user (); / / add user void del_user () / / Delete the user void display_user (); / / View the user void update_user (); / / modify the user void look_borrow (); / / View the borrowing of books void get_user (); / / user Management void recv_file (); / / Save the data to the file void read_file () / / read void recv_user () from the file; / / Save the user information to the file void read_user (); / / read the user information from the file}; Book::Book () {state = 0; strcpy (stu_number, "000"); strcpy (stu_name, "0") } / / Save book information to file void Mybook::recv_file () {ofstream outfile ("library.txt", ios::out); if (! outfile) {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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report