Current location - Training Enrollment Network - Books and materials - Library program function
Library program function
# include & ltiostream & gt

# include & ltfstream & gt// input/output file stream class

Use namespace std

const int Maxr = 100; //The most readers

const int Maxb = 100; //The most books

const int max bor = 5; //Each reader can borrow up to five books.

//reader class, which describes the information of readers.

Class reader

cout & lt& ltsetw(5)& lt; & lt No< setw (10) < & lt name & lt& lt "Borrowing number: [";

for(int I = 0; I & ltMaxbori++)

if(borbook[i]! =0)

cout & lt& ltbor book[I]& lt; & lt"|";

cout & lt& lt"]" & lt; & ltendl

file . read((char *)& amp; s,sizeof(s));

If (! File) interrupt;

CIN & gt; & gtrname

r-& gt; set name(rname);

Break;

Case "3":

Cout & lt& lt "Enter the card reader number:";

CIN & gt; & gtreaderid

r = query(readerid);

Cout & lt& lt "Readers don't exist"

Break;

//Book category, which realizes the description, book number, title, lending and return of books.

Int number; //Book number

char name[20]; //Book title

Strcpy (name, not applicable);

void del book(){ tag = 1; }//Delete books

Voiddaddbook (int n, char *na)// Add books.

tag = 0;

no = n;

Strcpy (name, not applicable);

on shelf = 1;

if(on self = = 1)

Void disp()// output books

assembler language

In order to solve a series of problems caused by writing applications in machine language, people first think of using mnemonics to replace machine instructions that are not easy to remember. This mnemonic language representing computer instructions is called symbolic language, also known as assembly language.

In assembly language, every assembly instruction represented by symbols corresponds to computer machine instructions one by one; The difficulty of memory is greatly reduced, which is not only easy to check and correct program errors, but also the storage location of instructions and data can be automatically allocated by the computer. A program written in assembly language is called a source program.