In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "C++ library management system program sample code", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and study the "C++ library management system program sample code" this article.
The details are as follows
C++ comprehensive experiment, the functions are basically realized, but the code to write some tedious, there is a lot of room for optimization, just for reference.
Experimental requirements
Experimental purpose:
1. The object-oriented programming method can be comprehensively used to design and implement a relatively complete information management application.
2. It can properly carry out topic analysis, experiment design, core code description, experiment result analysis and so on.
Experiment: design and write a C++ style application, simulate a library management system application, support system users of book lending, book management, user management and other functions. Book lending management mainly includes the functions of book lending, book return, borrowing information viewing and so on. Book management mainly includes the functions of adding, deleting, modifying, viewing, statistics and so on. User management mainly includes the functions of user registration, login, changing password, modifying personal information, setting user type and so on.
Specific requirements:
1. Define the Book bibliography class in the library management system (you can also define User user class, Log book loan and return log class, etc.).
2. Reasonably use the inheritance of the class to define the inheritance of collection resources, which can be divided into books, discs, electronic resources, etc. (or divide the system users into readers, librarians, system administrators).
3. According to different types of users, the login system displays different user function menus and realizes different operations. For example, the number and days of books borrowed by students and teachers are not the same (or consider the different user operations supported by a variety of collection resources in the library).
4. Add exception handling. When borrowing books, you will be prompted by the maximum number of books you can borrow. When returning books, you will need to pay a fine when the books are overdue.
5. Through the overloading operator "" to facilitate the operation of book information and reader information input, and to save the collection of book information and borrowing records to disk to form a book loan and return log file.
6. Extension experiment: try to use MFC visual interface to improve the convenience and friendliness of users.
Program source code # include#include#include#include// file input / output # include// controls input / output format # pragma warning (disable:4996) / / eliminates strcpy unsafe error prompt # define kouling2 "654321" using namespace std;class tt {/ / system current time public: int year; int month; int day; int hours; int minutes; int seconds; tt () {}} Tt system_time () / / get current time {tt pp; time_t nowtime; struct tm* p; time (& nowtime); p = localtime (& nowtime); pp.year = p-> tm_year + 1900; pp.month = p-> tm_mon + 1; pp.day = p-> tm_mday; pp.hours = p-> tm_hour; pp.minutes = p-> tm_min; pp.seconds = p-> tm_sec Return pp;} class Log;class Book {/ / Bibliographic protected: char leixing [50]; / / types of books, divided into paper books, CDs, e-books int no;// No. Char name [50]; / / title char author [50]; / / author char press [50]; / / Publishing House char price [50]; / / Price int state / / whether the book is on the shelf, 1 is on the shelf, 0 is the lent public: Book () {} friend Log; void set_name (char a []) / / sets the book title {strcpy (name, a);} void set_author (char a []) / / sets the author {strcpy (author, a) } void set_press (char a []) / / set publisher {strcpy (press, a);} void set_price (char a []) / / set price {strcpy (price, a);} void set_no (int a) / / set serial number {no = a } void set_state (int a) / / set book status {state = a;} char* get_name () / / get book title {return name;} char* get_author () / / get author {return author;} char* get_press () / / get publisher {return press } char* get_price () / / get the price {return price;} int get_no () / / get the number {return no;} int get_state () / / get the book status {return state } int chongfu_no (int no1) / / determines whether the number is duplicated. If 1 is returned, 0 is not repeated {char leixing [100] [50]; / / Book Type int x [100]; / / Book number char c [100] [50]; / / Book title char d [100] [50]; / / author char e [100] [50] / / Book publisher char f [100] [20]; / / Price int yy [100]; / / status int i; fstream in; in.open ("Book.text", ios::in); for (I = 0; in.eof +) {if (in.eof ()) / / determine whether it reaches the end of the file {break } in > > leixing [I] > > x [I] > > c [I] > > d [I] > > e [I] > > f [I] > > yy [I]; / / Reading the book information if (no1 = = x [I]) / / the number already exists {cout d [I]; in > > e [I]; in > > f [I] Num++;} in.close (); for (I = 0 X I > d [I]; in > > e [I]; in > > f [I] If (strcmp (e [I], name) = = 0) / / find the user {if (n = = 1) {memset (name,'\ 0mm, sizeof (name)); / / clear the array strcpy (name, a) Memset (e [I],'\ 0mm, sizeof (e [I])); / / clear the array strcpy (e [I], a);} if (n = = 2) {memset (password,'\ 0mm, sizeof (password) / / empty the array strcpy (password, a); memset (f [I],'\ 0mm, sizeof (f [I])); / / empty the array strcpy (f [I], a);}} num++;} in.close (); fstream out Out.open ("User.text", ios::out | ios::trunc); for (I = 0
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.