收录日期:2019/11/19 15:08:09 时间:2016/07/26 19:55:51 标签:C++ 语言
#include<iostream>
#include<stdlib.h>
#include<string.h>
#progmma comment(lib, "ws2_32.lib")
using namespace std;
class Tempbook;
class Book;
class Borrower;
class Student;
class Teacher;
Book* book_s;
Book* book_e;
Borrower* borrower_s;
Borrower* borrower_e;
class Book{
char* name;
int number;
public:
Book* next;
int remain;
int id;
Book(char* n,int i,int nu):id(i),number(nu),remain(nu){
name=n;
}
~Book(){
delete []name;
}
void display(){
cout<<"书名:"<<name<<" 书号:"<<id<<" 总数:"<<number<<" 剩余数:"<<remain<<endl;
}
};
class Borrower{
public:
    char* name;
    char* colleage;
Borrower* next;
Tempbook* tp_s;
Tempbook* tp_e;
int id;
Borrower(char* n,char* c,int i):name(n),colleage(c),id(i){
next=NULL;
tp_s=NULL;
tp_e=NULL;
}
virtual ~Borrower(){}
virtual void display()=0;
};
class Student:public Borrower{
public:
static int stotal;
Student(char* n,char* c,int s):Borrower(n,c,s){
stotal++;
}
~Student(){
stotal--;
}
void display(){
cout<<"姓名:"<<name<<" 学院:"<<colleage<<" 图书证号:"<<id<<endl;
}
};
class Teacher:public Borrower{
char* job;
public:
static int ttotal;
Teacher(char* n,char* c,int t,char* j):Borrower(n,c,t),job(j){
ttotal++;
}
~Teacher(){
ttotal--;
}
void display(){
cout<<"姓名:"<<name<<" 学院:"<<colleage<<" 图书证号:"<<id<<" 职称:"<<job<<endl;
}
};
class Tempbook{
public:
    int id;
int year;
int month;
int day;
Tempbook* next;
Tempbook(int i,int y,int m,int d):id(i),year(y),month(m),day(d){
next=NULL;
}
~Tempbook(){
}
};
void regist(){
cout<<"请输入您的身份\n1.学生 2.教师\n";
int i;
cin>>i;
switch(i){
case 1:
cout<<"请输入你的姓名,学院,学号:\n";
char n[20];
char m[20];
int s;
cin>>n>>m>>s;
Borrower* bp;
bp=new Student(n,m,s);
if(borrower_s==NULL)
{
borrower_s=bp;
borrower_e=bp;
}
else
{
borrower_e->next=bp;
borrower_e=bp;
}
break;
case 2:
cout<<"请输入你的姓名 学院 学号 职称:\n";
char j[20];
cin>>n>>m>>s>>j;
bp=new Teacher(n,m,s,j);
if(borrower_s==NULL)
{
borrower_s=bp;
borrower_e=bp;
}
else
{
borrower_e->next=bp;
borrower_e=bp;
}
}
}
Book* find(int i){
Book* bp=book_s;
while (bp->id!=i && bp!=NULL){
bp=bp->next;
}
if (bp->id==i)
return bp;
else
return NULL;
}
Book* find_pre(int i){
Book* bp=book_s;
Book* btp=find(i);
{if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==book_s)
return NULL;
else
while(bp->next!=btp)
{
bp=bp->next;
}
}
return bp;
}
Book* find_ne(int i){
Book* bp=book_s;
Book* btp=find(i);
{
if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==book_e)
return NULL;
else
bp=btp->next;
}
return bp;
}
Borrower* search(int i){
Borrower* bp=borrower_s;
while (bp->id!=i && bp!=NULL)
{
bp=bp->next;
}
if(bp->id==i)
return bp;
else
return NULL;
}
Borrower* search_pre(int i){
Borrower* btp=search(i);
Borrower* bp=borrower_s;
{
if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==borrower_s)
return NULL;
else
while(bp->next!=btp)
{
bp=bp->next;
}
}
return bp;
}
Borrower* search_ne(int i){
Borrower* btp=search(i);
Borrower* bp=borrower_s;
{
if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==borrower_e)
return NULL;
else
bp=btp->next;
}
return bp;
}
void borrow(Borrower* bp){
cout<<"请输入你要借的书的书号:\n";
int i;
cin>>i;
Book* mp=find(i);
if(mp->remain==0)
{
cout<<"sorry there is no book remaining.\n";
exit(0);
}
else
{
mp->remain--;
cout<<"请输入年  月   日\n";
int y,m,d;
Tempbook* tp=new Tempbook(i,y,m,d);
if(bp->tp_s==NULL)
{
bp->tp_s=tp;
bp->tp_e=tp;
}
else
{
bp->tp_e->next=tp;
bp->tp_e=tp;
}
}
}
Tempbook* find_b(Borrower* bp,int i){
Tempbook* tp=bp->tp_s;
while (tp->id!=i && tp!=NULL)
{
tp=tp->next;
}
if(tp->id==i)
{
return tp;
}
else
{
cout<<"you have not borrow the book.\n";
exit(0);
}
}
void returnb(Borrower* bp){
cout<<"请输入你要还的书的书号.\n";
int i;
cin>>i;
Tempbook* tp=find_b(bp,i);
if(tp==bp->tp_e)
{
bp->tp_s=tp->next;
delete tp;
}
else
if(tp==bp->tp_e)
{
Tempbook* tmp=bp->tp_s;
while (tmp->next!=bp->tp_e)
{
tmp=tmp->next;
}
bp->tp_e=tmp;
delete tp;
}
else
{
Tempbook* tmp=bp->tp_s;
while(tmp->next!=tp)
{
tmp=tmp->next;
}
tmp->next=tp->next;
delete tp;
}
}
void log_off(){
cout<<"请输入你的id\n";
int i;
cin>>i;
Borrower* bp=search(i);
while (bp->tp_s!=NULL)
{
returnb(bp);
}
if(bp->next==NULL)
{
borrower_e=search_pre(i);
delete bp;
}
else
if(bp==borrower_s)
{
search_pre(i)->next=bp->next;
delete bp;
}
}
void main(){
Student::stotal=0;
Teacher::ttotal=0;
borrower_s=NULL;
borrower_e=NULL;
Book b1("aaa",111,500);
Book b2("bbb",112,500);
Book b3("ccc",113,500);
Book b4("ddd",114,500);
Book b5("eee",115,500);
book_s=&b1;
b1.next=&b2;
b2.next=&b3;
b3.next=&b4;
b4.next=&b5;
b5.next=NULL;
book_e=&b5;
cout<<"欢迎来到图书馆\n";
cout<<"请按提示操作\n";
T:
cout<<"1.注册\n2.注销\n3.登录\n4.查询\n5.退出\n6.书库一览\n";
int i;
cin>>i;
switch(i){
case 1:
regist();
cout<<"您已经注册成功\n";
goto T;
case 2:
log_off();
cout<<"您已经成功注销\n";
goto T;
case 3:
{
cout<<"请输入您的id\n";
int m;
cin>>m;
Borrower* bp=search(m);
M:
cout<<"1.借书 2.还书 3.返回主菜单\n";
int k;
cin>>k;
switch(k){
case 1:
borrow(bp);
goto M;
case 2:
returnb(bp);
goto M;
case 3:
goto T;
}
}
case 4:
R:
cout<<"1.根据id查询所借的所有图书\n2.根据图书id查询所有的借阅者\n3.根据日期查询超期借阅者\n4.查询注册人数\n5.返回主菜单\n";
int l;
cin>>l;
switch(l){
case 1:
{
cout<<"请输入要查询的id\n";
int ak;
cin>>ak;
Borrower* bp=search(ak);
Tempbook* tp=bp->tp_s;
while (tp!=NULL){
cout<<"书号:"<<tp->id<<" 日期:"<<tp->year<<"年"<<tp->month<<"月"<<tp->day<<"日\n";
tp=tp->next;
}
goto R;
}
case 2:
{
cout<<"请输入你要查的书的id\n";
int ak;
cin>>ak;
Borrower* bp=borrower_s;
while(bp!=NULL){
Tempbook* fp=find_b(bp,ak);
if (fp!=NULL)
{
bp->display();
bp=bp->next;
}
else
bp=bp->next;
}
goto R;
}
case 4:
cout<<"总人数为:"<<Student::stotal+Teacher::ttotal<<endl;
}
}
}










写#progmma comment(lib, "ws2_32.lib")出现错误fatal error C1021: invalid preprocessor command 'progmma'
不写出现link错误





#include<iostream>
#include<stdlib.h>
#include<string.h>
//#progmma comment(lib, "ws2_32.lib")
using namespace std;
class Tempbook;
class Book;
class Borrower;
class Student;
class Teacher;
Book* book_s;
Book* book_e;
Borrower* borrower_s;
Borrower* borrower_e;
class Book{
    const char* name;
    int number;
    //
public:
    Book* next;
    int remain;
    int id;
    Book(const char* n,int i,int nu):id(i),number(nu),remain(nu){
        name=n;
    }
    ~Book(){
    delete []name;
    }
    void display(){
        cout<<"书名:"<<name<<" 书号:"<<id<<" 总数:"<<number<<" 剩余数:"<<remain<<endl;
    }
};
class Borrower{
public:
       char* name;
    char* colleage;
    Borrower* next;
    Tempbook* tp_s;
    Tempbook* tp_e;
    int id;
    Borrower(char* n,char* c,int i):name(n),colleage(c),id(i){
        next=NULL;
        tp_s=NULL;
        tp_e=NULL;
    }
    virtual ~Borrower(){}
    virtual void display()=0;
};
class Student:public Borrower{
public:
    static int stotal;
    Student(char* n,char* c,int s):Borrower(n,c,s){
        stotal++;
    }
    ~Student(){
        stotal--;
    }
    void display(){
        cout<<"姓名:"<<name<<" 学院:"<<colleage<<" 图书证号:"<<id<<endl;
    }
};
class Teacher:public Borrower{
    char* job;
public:
    static int ttotal;
    Teacher(char* n,char* c,int t,char* j):Borrower(n,c,t),job(j){
        ttotal++;
    }
    ~Teacher(){
        ttotal--;
    }
    void display(){
        cout<<"姓名:"<<name<<" 学院:"<<colleage<<" 图书证号:"<<id<<" 职称:"<<job<<endl;
    }
};
class Tempbook{
public:
    int id;
    int year;
    int month;
    int day;
    Tempbook* next;
    Tempbook(int i,int y,int m,int d):id(i),year(y),month(m),day(d){
        next=NULL;
    }
    ~Tempbook(){
    }
};
void regist(){
    cout<<"请输入您的身份\n1.学生 2.教师\n";
    int i;
    cin>>i;
    switch(i){
    case 1:
        cout<<"请输入你的姓名,学院,学号:\n";
        char n[20];
        char m[20];
        int s;
        cin>>n>>m>>s;
        Borrower* bp;
        bp=new Student(n,m,s);
        if(borrower_s==NULL)
        {
            borrower_s=bp;
            borrower_e=bp;
        }
        else
        {
            borrower_e->next=bp;
            borrower_e=bp;
        }
        break;
    case 2:
        cout<<"请输入你的姓名 学院 学号 职称:\n";
        char j[20];
        cin>>n>>m>>s>>j;
        bp=new Teacher(n,m,s,j);
        if(borrower_s==NULL)
        {
            borrower_s=bp;
            borrower_e=bp;
        }
        else
        {
            borrower_e->next=bp;
            borrower_e=bp;
        }
    }
}
Book* find(int i){
    Book* bp=book_s;
    while (bp->id!=i && bp!=NULL){
        bp=bp->next;
    }
    if (bp->id==i)
        return bp;
    else
        return NULL;
}
Book* find_pre(int i){
    Book* bp=book_s;
    Book* btp=find(i);
    {if(btp==NULL)
        {
        cout<<"not find.\n";
        exit(0);
    }
    else
        if(btp==book_s)
            return NULL;
        else
            while(bp->next!=btp)
            {
                bp=bp->next;
            }
    }
            return bp;
}
Book* find_ne(int i){
    Book* bp=book_s;
    Book* btp=find(i);
    {
    if(btp==NULL)
    {
        cout<<"not find.\n";
        exit(0);
    }
    else
        if(btp==book_e)
            return NULL;
        else
            bp=btp->next;
    }
        return bp;
}
Borrower* search(int i){
    Borrower* bp=borrower_s;
    while (bp->id!=i && bp!=NULL)
    {
        bp=bp->next;
    }
    if(bp->id==i)
        return bp;
    else
        return NULL;
}
Borrower* search_pre(int i){
    Borrower* btp=search(i);
    Borrower* bp=borrower_s;
    {
        if(btp==NULL)
    {
        cout<<"not find.\n";
        exit(0);
    }
    else
        if(btp==borrower_s)
            return NULL;
        else
            while(bp->next!=btp)
            {
                bp=bp->next;
            }
    }
    return bp;
}
Borrower* search_ne(int i){
    Borrower* btp=search(i);
    Borrower* bp=borrower_s;
    {
    if(btp==NULL)
    {
        cout<<"not find.\n";
        exit(0);
    }
    else
        if(btp==borrower_e)
            return NULL;
        else
            bp=btp->next;
    }
    return bp;
}
void borrow(Borrower* bp){
    cout<<"请输入你要借的书的书号:\n";
    int i;
    cin>>i;
    Book* mp=find(i);
    if(mp->remain==0)
    {
        cout<<"sorry there is no book remaining.\n";
        exit(0);
    }
    else
    {
        mp->remain--;
        cout<<"请输入年  月   日\n";
        int y,m,d;
        Tempbook* tp=new Tempbook(i,y,m,d);
        if(bp->tp_s==NULL)
        {
            bp->tp_s=tp;
            bp->tp_e=tp;
        }
        else
        {
            bp->tp_e->next=tp;
            bp->tp_e=tp;
        }
    }
}
Tempbook* find_b(Borrower* bp,int i){
    Tempbook* tp=bp->tp_s;
    while (tp->id!=i && tp!=NULL)
    {
        tp=tp->next;
    }
    if(tp->id==i)
    {
        return tp;
    }
    else
    {
        cout<<"you have not borrow the book.\n";
        exit(0);
    }
}
void returnb(Borrower* bp){
    cout<<"请输入你要还的书的书号.\n";
    int i;
    cin>>i;
    Tempbook* tp=find_b(bp,i);
    if(tp==bp->tp_e)
    {
        bp->tp_s=tp->next;
        delete tp;
    }
    else
        if(tp==bp->tp_e)
        {
            Tempbook* tmp=bp->tp_s;
            while (tmp->next!=bp->tp_e)
            {
                tmp=tmp->next;
            }
            bp->tp_e=tmp;
            delete tp;
        }
        else
        {
            Tempbook* tmp=bp->tp_s;
            while(tmp->next!=tp)
            {
                tmp=tmp->next;
            }
            tmp->next=tp->next;
            delete tp;
        }
}
void log_off(){
    cout<<"请输入你的id\n";
    int i;
    cin>>i;
    Borrower* bp=search(i);
    while (bp->tp_s!=NULL)
    {
        returnb(bp);
    }
    if(bp->next==NULL)
    {
        borrower_e=search_pre(i);
        delete bp;
    }
    else
        if(bp==borrower_s)
        {
            search_pre(i)->next=bp->next;
            delete bp;
        }
}

int Student::stotal=0;
int Teacher::ttotal=0;
 main(){

    borrower_s=NULL;
    borrower_e=NULL;
    Book b1("aaa",111,500);
    Book b2("bbb",112,500);
    Book b3("ccc",113,500);
    Book b4("ddd",114,500);
    Book b5("eee",115,500);
    book_s=&b1;
    b1.next=&b2;
    b2.next=&b3;
    b3.next=&b4;
    b4.next=&b5;
    b5.next=NULL;
    book_e=&b5;
    cout<<"欢迎来到图书馆\n";
    cout<<"请按提示操作\n";
T:
    cout<<"1.注册\n2.注销\n3.登录\n4.查询\n5.退出\n6.书库一览\n";
    int i;
    cin>>i;
    switch(i){
    case 1:
        regist();
        cout<<"您已经注册成功\n";
        goto T;
    case 2:
        log_off();
        cout<<"您已经成功注销\n";
        goto T;
    case 3:
        {
            cout<<"请输入您的id\n";
        int m;
        cin>>m;
        Borrower* bp=search(m);
M:
        cout<<"1.借书 2.还书 3.返回主菜单\n";
        int k;
        cin>>k;
        switch(k){
        case 1:
            borrow(bp);
            goto M;
        case 2:
            returnb(bp);
            goto M;
        case 3:
            goto T;
        }
        }
    case 4:
R:
        cout<<"1.根据id查询所借的所有图书\n2.根据图书id查询所有的借阅者\n3.根据日期查询超期借阅者\n4.查询注册人数\n5.返回主菜单\n";
        int l;
        cin>>l;
        switch(l){
        case 1:
            {
            cout<<"请输入要查询的id\n";
            int ak;
            cin>>ak;
            Borrower* bp=search(ak);
            Tempbook* tp=bp->tp_s;
            while (tp!=NULL){
                cout<<"书号:"<<tp->id<<" 日期:"<<tp->year<<"年"<<tp->month<<"月"<<tp->day<<"日\n";
                tp=tp->next;
            }
            goto R;
            }
        case 2:
            {
            cout<<"请输入你要查的书的id\n";
            int ak;
            cin>>ak;
            Borrower* bp=borrower_s;
            while(bp!=NULL){
                Tempbook* fp=find_b(bp,ak);
                if (fp!=NULL)
                {
                    bp->display();
                    bp=bp->next;
                }
                else
                    bp=bp->next;
            }
            goto R;
            }
        case 4:
            cout<<"总人数为:"<<Student::stotal+Teacher::ttotal<<endl;
        }
    }
}











main函数里面这里出错了:
Student::stotal=0;
Teacher::ttotal=0;

类里面的静态变量需要在类外面赋值,直接写在类大括号后面:
int Student::stotal = 0;
int Teacher::ttotal = 0; //这样就没错误了。 
你说的那个#progmma注释掉。
完整代码如下:

#include<iostream>
#include<stdlib.h>
#include<string.h>
// #progmma comment(lib, "ws2_32.lib") 
using namespace std;
class Tempbook;
class Book;
class Borrower;
class Student;
class Teacher;
Book* book_s;
Book* book_e;
Borrower* borrower_s;
Borrower* borrower_e;
class Book{
char* name;
int number;
public:
Book* next;
int remain;
int id;
Book(char* n,int i,int nu):id(i),number(nu),remain(nu){
name=n;
}
~Book(){
delete []name;
}
void display(){
cout<<"书名:"<<name<<" 书号:"<<id<<" 总数:"<<number<<" 剩余数:"<<remain<<endl;
}
};
class Borrower{
public:
char* name;
char* colleage;
Borrower* next;
Tempbook* tp_s;
Tempbook* tp_e;
int id;
Borrower(char* n,char* c,int i):name(n),colleage(c),id(i){
next=NULL;
tp_s=NULL;
tp_e=NULL;
}
virtual ~Borrower(){}
virtual void display()=0;
};
class Student:public Borrower{
public:
static int stotal;
Student(char* n,char* c,int s):Borrower(n,c,s){
stotal++;
}
~Student(){
stotal--;
}
void display(){
cout<<"姓名:"<<name<<" 学院:"<<colleage<<" 图书证号:"<<id<<endl;
}
};
class Teacher:public Borrower{
char* job;
public:
static int ttotal;
Teacher(char* n,char* c,int t,char* j):Borrower(n,c,t),job(j){
ttotal++;
}
~Teacher(){
ttotal--;
}
void display(){
cout<<"姓名:"<<name<<" 学院:"<<colleage<<" 图书证号:"<<id<<" 职称:"<<job<<endl;
}
};
class Tempbook{
public:
int id;
int year;
int month;
int day;
Tempbook* next;
Tempbook(int i,int y,int m,int d):id(i),year(y),month(m),day(d){
next=NULL;
}
~Tempbook(){
}
};
void regist(){
cout<<"请输入您的身份\n1.学生 2.教师\n";
int i;
cin>>i;
switch(i){
case 1:
cout<<"请输入你的姓名,学院,学号:\n";
char n[20];
char m[20];
int s;
cin>>n>>m>>s;
Borrower* bp;
bp=new Student(n,m,s);
if(borrower_s==NULL)
{
borrower_s=bp;
borrower_e=bp;
}
else
{
borrower_e->next=bp;
borrower_e=bp;
}
break;
case 2:
cout<<"请输入你的姓名 学院 学号 职称:\n";
char j[20];
cin>>n>>m>>s>>j;
bp=new Teacher(n,m,s,j);
if(borrower_s==NULL)
{
borrower_s=bp;
borrower_e=bp;
}
else
{
borrower_e->next=bp;
borrower_e=bp;
}
}
}
Book* find(int i){
Book* bp=book_s;
while (bp->id!=i && bp!=NULL){
bp=bp->next;
}
if (bp->id==i)
return bp;
else
return NULL;
}
Book* find_pre(int i){
Book* bp=book_s;
Book* btp=find(i);
{if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==book_s)
return NULL;
else
while(bp->next!=btp)
{
bp=bp->next;
}
}
return bp;
}
Book* find_ne(int i){
Book* bp=book_s;
Book* btp=find(i);
{
if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==book_e)
return NULL;
else
bp=btp->next;
}
return bp;
}
Borrower* search(int i){
Borrower* bp=borrower_s;
while (bp->id!=i && bp!=NULL)
{
bp=bp->next;
}
if(bp->id==i)
return bp;
else
return NULL;
}
Borrower* search_pre(int i){
Borrower* btp=search(i);
Borrower* bp=borrower_s;
{
if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==borrower_s)
return NULL;
else
while(bp->next!=btp)
{
bp=bp->next;
}
}
return bp;
}
Borrower* search_ne(int i){
Borrower* btp=search(i);
Borrower* bp=borrower_s;
{
if(btp==NULL)
{
cout<<"not find.\n";
exit(0);
}
else
if(btp==borrower_e)
return NULL;
else
bp=btp->next;
}
return bp;
}
void borrow(Borrower* bp){
cout<<"请输入你要借的书的书号:\n";
int i;
cin>>i;
Book* mp=find(i);
if(mp->remain==0)
{
cout<<"sorry there is no book remaining.\n";
exit(0);
}
else
{
mp->remain--;
cout<<"请输入年  月   日\n";
int y,m,d;
Tempbook* tp=new Tempbook(i,y,m,d);
if(bp->tp_s==NULL)
{
bp->tp_s=tp;
bp->tp_e=tp;
}
else
{
bp->tp_e->next=tp;
bp->tp_e=tp;
}
}
}
Tempbook* find_b(Borrower* bp,int i){
Tempbook* tp=bp->tp_s;
while (tp->id!=i && tp!=NULL)
{
tp=tp->next;
}
if(tp->id==i)
{
return tp;
}
else
{
cout<<"you have not borrow the book.\n";
exit(0);
}
}
void returnb(Borrower* bp){
cout<<"请输入你要还的书的书号.\n";
int i;
cin>>i;
Tempbook* tp=find_b(bp,i);
if(tp==bp->tp_e)
{
bp->tp_s=tp->next;
delete tp;
}
else
if(tp==bp->tp_e)
{
Tempbook* tmp=bp->tp_s;
while (tmp->next!=bp->tp_e)
{
tmp=tmp->next;
}
bp->tp_e=tmp;
delete tp;
}
else
{
Tempbook* tmp=bp->tp_s;
while(tmp->next!=tp)
{
tmp=tmp->next;
}
tmp->next=tp->next;
delete tp;
}
}
void log_off(){
cout<<"请输入你的id\n";
int i;
cin>>i;
Borrower* bp=search(i);
while (bp->tp_s!=NULL)
{
returnb(bp);
}
if(bp->next==NULL)
{
borrower_e=search_pre(i);
delete bp;
}
else
if(bp==borrower_s)
{
search_pre(i)->next=bp->next;
delete bp;
}
}
int Student::stotal=0;
int Teacher::ttotal=0;
void main(){

borrower_s=NULL;
borrower_e=NULL;
Book b1("aaa",111,500);
Book b2("bbb",112,500);
Book b3("ccc",113,500);
Book b4("ddd",114,500);
Book b5("eee",115,500);
book_s=&b1;
b1.next=&b2;
b2.next=&b3;
b3.next=&b4;
b4.next=&b5;
b5.next=NULL;
book_e=&b5;
cout<<"欢迎来到图书馆\n";
cout<<"请按提示操作\n";
T:
cout<<"1.注册\n2.注销\n3.登录\n4.查询\n5.退出\n6.书库一览\n";
int i;
cin>>i;
switch(i){
case 1:
regist();
cout<<"您已经注册成功\n";
goto T;
case 2:
log_off();
cout<<"您已经成功注销\n";
goto T;
case 3:
{
cout<<"请输入您的id\n";
int m;
cin>>m;
Borrower* bp=search(m);
M:
cout<<"1.借书 2.还书 3.返回主菜单\n";
int k;
cin>>k;
switch(k){
case 1:
borrow(bp);
goto M;
case 2:
returnb(bp);
goto M;
case 3:
goto T;
}
}
case 4:
R:
cout<<"1.根据id查询所借的所有图书\n2.根据图书id查询所有的借阅者\n3.根据日期查询超期借阅者\n4.查询注册人数\n5.返回主菜单\n";
int l;
cin>>l;
switch(l){
case 1:
{
cout<<"请输入要查询的id\n";
int ak;
cin>>ak;
Borrower* bp=search(ak);
Tempbook* tp=bp->tp_s;
while (tp!=NULL){
cout<<"书号:"<<tp->id<<" 日期:"<<tp->year<<"年"<<tp->month<<"月"<<tp->day<<"日\n";
tp=tp->next;
}
goto R;
}
case 2:
{
cout<<"请输入你要查的书的id\n";
int ak;
cin>>ak;
Borrower* bp=borrower_s;
while(bp!=NULL){
Tempbook* fp=find_b(bp,ak);
if (fp!=NULL)
{
bp->display();
bp=bp->next;
}
else
bp=bp->next;
}
goto R;
}
case 4:
cout<<"总人数为:"<<Student::stotal+Teacher::ttotal<<endl;
}
}
}

How to add hundreds files in a project ?VC6.0 SQL产生日志的探讨。欢迎各位进来讨论讨论。 请教NT+APACHE的服务器应该如何限制其中用户的在线限制 怎样在触发器里显示消息?用 raiserror(\'xx,10,10\')为什么不显示? 请问用java开发软件怎样控制服务器上的软件?简单的说可以是远程控制软件?急用!!在线等待! C++Builder中可以使用ORACLE游标吗?怎么用? 问题!关于如何屏蔽DBGrid-Options设置中的dbconfirmDelete功能? 老师说的例题,可是不行…… 请问大家一个英语问题,“进销存管理系统”如何翻译? 在WORD文档里,如何取得光标所在位置的行和列? CGI安全 谁有语音聊天技术方面的文档? 如何在SQL服務器端將一個數值轉換格式為 ###,###,###.### 给分:JSP取SQL 2000中文数据,显示出来就却是乱码 Functions 在线吗.还有高手知道请告知:Powersoft Report 类型的文件不通过dw_1.还有其它的方法打开吗? 请问大家一个英语问题,“进销存管理系统”如何翻译? 泡MM高招统计......... 制做安装包时怎样删除指定的目录? 请教众高人有关ADO数据集转换到EXECLE表的问题 请问如何将bytes的内容显示在界面上,如何将bytes转换成为string类型 我就是要散分,感谢大家不要可以啊,大家赶快,中午结贴 如何实现stringgrid里面字符串的换行 大家来帮我呀!有高分向赠! 各位位大哥知道数据库中的代理键是什么?怎么使用?能详细的给我讲讲么?回帖的都有分!3ks! delphi的建模工具有那些?常用哪个?大家开发DELPHI项目都建模吗? biennale.py python病毒 只因贴了全智贤A片网址,竟被斑竹删贴,减信誉值,痛苦中!!! 谁有会议安排的库,简单的就行 装了一个sytle report EE4.4,但是无法将其集成到jbuilder的开发环境中,请各位指教! 关于树的节点拖放的问题