1.

1.1 设计内容:

编写一个简单的实验室设备管理程序,帮助管理实验室设备信息。要求具有设备信息管理的功能。其中包括设备信息的录入、删除、查询和修改等功能。还应包括对实验室信息管理的功能。其中包括对实验室信息的录入、删除、修改和查询等功能。

1.2 任务和要求

运用面向对象的程序设计方法,要求选择动态数组类模板或链表类模板,任务中要运用I/O流对象对文件进行读写操作。

1.3 提供的基本管理功能有:

添加:即增加一条信息到设备信息中,或增加一条信息到实验室信息中;
显示:即在屏幕上显示所有设备或实验室信息;
存储:即将设备信息和实验室信息分别保存在文件中;
装入:即将文件中的信息读入程序;
查询:可根据设备名称查找具体情况,若找到,显示在屏幕上;
修改:可修改设备信息,或对实验室信息进行修改。
普通管理员的账户可以由vip管理员添加
vip 管理员账号:admin 密码:123456

2. 代码实现

#include<iostream>
#include<string>
#include<cstring>
#include <iomanip>
#include <cstdlib>
#include<conio.h>
#include<fstream>
#include<windows.h>
using namespace std;
#define H "----------------------------------------------------------------n"
#define H1 "|   编号    |     类别  |    名称    |    价格    |  库存数量  |n"
#define H2 "|-----------|-----------|------------|------------|------------|n"
#define H3 "--------------------------n"
#define H4 "|   账号    |    密码    |n"
#define H5 "|-----------|------------|n"
class machine
{
public:
     machine();
	 machine(string a,string b,string c,double d,int e);
	 //char inter_face();//首页
     void add();//添加数据
     void dele();//删除数据
     void show();//显示所有
     void alter();//修改数据
     void select();//查询数据
     void save_new();//保存新增加数据
private:
	string num;
	string category;
	string name;
	double price;
	int quantity;
};
class account
{
public:
    account();
    char home_face();
	virtual void entrance();
   // void enter;
private:
    string id;
    string password;
};
class admin:public account
{
public:
   admin();
   virtual void admin_enter();
   void entrance();
private:
    string id;
    string password;
};
class vip:public admin
{
public:
	vip();
	void vip_enter();
	void entrance();
	void inter_face();//首页
    void add();//添加数据
    void dele();//删除数据
    void show();//显示所有
    void alter();//修改数据
    void select();//查询数据
    void save_new();//保存新增加数据
private:
    string id;
    string password;
};
machine::machine()
{
	 num=" ";
	 category=" ";
	 name=" ";
	 price=0;
	 quantity=0;
}
account::account()
{
	id=" ";
	password=" ";
}
admin::admin()
{
	id=" ";
	password=" ";
}
vip::vip()
{
	id="admin";
	password="123456";
}
void account::entrance()
{
	system("color 0b");
    char n;
    machine m;
	while(1)
	{
    system("cls");
    cout <<endl;
	cout<<"tt  O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nn";
    cout<<"tt╔*☆***◎***◇***☆*** 菜单 ***☆***◇***◎***☆*╗n";
    cout<<"tt|★|tt               ttt|★|n";
	cout<<"tt|☆|tt               ttt|☆|n";
	cout<<"tt|★|tt 1.设备信息显示ttt|★|n";
    cout<<"tt|☆|tt 2.设备信息查询ttt|☆|n";
	cout<<"tt|★|tt 3.返回        ttt|★|n";
	cout<<"tt|☆|tt               ttt|☆|n";
	cout<<"tt|★|tt               ttt|★|n";
	cout<<"tt|☆|tt               ttt|☆|n";
	cout<<"tt╚*☆***◎***◇****☆****★****☆****◇***◎***☆*╝nn";
    cout<<"tt请选择您要实现的功能选项 (1-3): [ ]bb";
	while(1)
	{
		cin>>n;getchar();
		if(n<'1'||n>'3')
			printf("输入错误,请您重新输入选项(1-3):[ ]bb");
		else
			break;
	}
	if(n=='1') {m.show();}
	if(n=='2') m.select();
	if(n=='3') return;
	}
}
void admin::admin_enter()
{
    string pp;
	char m;
	admin Admin;
	system("cls");
	cout<<endl<<endl<<endl;
	cout<<"tt O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nnn";
   while(1)
   {
	ifstream inData("e:\Document.txt",ios::in);
   cout<<"tt 请输入您的管理员账号:ntt  (若返回上一个页面,请输入#号)"<<endl;
   cout<<"tt ";
   cin>>pp;
    if (!inData)
    {
        cout <<endl <<"n对不起!账号不存在" <<endl;
        system("pause");
        return;
    }
   if(pp=="#") return;
    string qq;
    l:; cout<<"tt 请输入您的密码:n";
    cout<<"tt ";
    while(1)
    {
       m=getch();
       if(m==13) break;
       if(m!=8) qq+=m;
       if(m==8) {cout<<endl;goto l;}
       cout<<"*";
    }
    bool flag =true;
    string str;
    while (inData>>id>>password)
    {
        getline(inData, str);
        if (id==pp)
        {
			flag = false;
			if(password==qq)
			{
                 Admin.entrance();
                 return;
			}
            else
             cout<<"ntt    对不起!密码错误!!n"<<endl;
        }
    }
    if(flag)
    {
        cout<<"ntt    对不起!账号不存在!!n"<<endl;
        //system("pause");
    }
 
   }
 
}
void vip::vip_enter()
{
   string pp;
   char m;
   vip VIP;
   admin Admin;
   system("cls");
   cout<<endl<<endl;
   cout<<"tt O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nnn";
   while(1)
   {
   cout<<"tt   请输入您的vip管理员账号:ntt     (若返回上一个页面,请输入#号)"<<endl;
   cout<<"tt   ";
   cin>>pp;
   getchar();
   if(pp=="#") return;
   if(pp==VIP.id)
   {
	   L:;cout<<"tt   请输入您的密码:"<<endl;
	   cout<<"tt   ";
       string qq;
       while(1)
       {
       m=getch();
       if(m==13) break;
       if(m!=8) qq+=m;
       if(m==8)
        {
            cout<<endl;goto L;
        }
       cerr<<"*";
       }
	   if(qq==VIP.password)
	   {
		   VIP.entrance();
		   break;
	   }
	   else
	   {
		  cout<<"ntt    对不起!密码错误!!n"<<endl;
	   }
   }
   else
   {
          cout<<"tt    对不起!账号不存在!!n"<<endl;
   }
   }
}
void admin::entrance()
{
   system("color 0c");
   char n;
    machine Machine;
	account Account;
	while(1)
	{
    system("cls");
    cout <<endl;
	cout<<"tt  O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nn";
    cout<<"tt╔*☆***◎***◇***☆*** 菜单 ***☆***◇***◎***☆*╗n";
    cout<<"tt|★|tt               ttt|★|n";
	cout<<"tt|☆|tt 1.设备信息录入ttt|☆|n";
	cout<<"tt|★|tt 2.设备信息显示ttt|★|n";
    cout<<"tt|☆|tt 3.设备信息查询ttt|☆|n";
	cout<<"tt|★|tt 4.设备信息修改ttt|★|n";
	cout<<"tt|☆|tt 5.设备信息删除ttt|☆|n";
	cout<<"tt|★|tt 6.返回tttt|★|n";
	cout<<"tt|☆|tt               ttt|☆|n";
	cout<<"tt╚*☆***◎***◇****☆****★****☆****◇***◎***☆*╝nn";
    cout<<"tt请选择您要实现的功能选项 (1-6): [ ]bb";
	while(1)
	{
		cin>>n;getchar();
		if(n<'1'||n>'6')
			printf("输入错误,请您重新输入选项(1-6):[ ]bb");
		else
			break;
	}
    switch(n)
	{
    case '1':Machine.add();break;
	case '2':Machine.show();break;
	case '3':Machine.select();break;
	case '4':Machine.alter();break;
	case '5':Machine.dele();break;
    case '6':return;
	}
	}
}
void vip::entrance()
{
   system("color 0e");
    char n;
    machine Machine;
	vip VIP;
	while(1)
	{
    system("cls");
    cout <<endl;
	cout<<"tt  O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nn";
    cout<<"tt╔*☆***◎***◇***☆*** 菜单 ***☆***◇***◎***☆*╗n";
    cout<<"tt|★|tt                    tt|★|n";
	cout<<"tt|☆|tt1.设备信息录入      tt|☆|n";
	cout<<"tt|★|tt2.设备信息显示      tt|★|n";
    cout<<"tt|☆|tt3.设备信息查询      tt|☆|n";
	cout<<"tt|★|tt4.设备信息修改      tt|★|n";
	cout<<"tt|☆|tt5.设备信息删除      tt|☆|n";
	cout<<"tt|★|tt6.编辑管理员信息    tt|★|n";
	cout<<"tt|★|tt7.返回              tt|★|n";
	cout<<"tt|☆|tt                    tt|☆|n";
	cout<<"tt╚*☆***◎***◇****☆****★****☆****◇***◎***☆*╝nn";
    cout<<"tt请选择您要实现的功能选项 (1-7): [ ]bb";
	while(1)
	{
		cin>>n;getchar();
		if(n<'1'||n>'7')
			printf("输入错误,请您重新输入选项(1-7):[ ]bb");
		else
			break;
	}
    switch(n)
	{
    case '1':Machine.add();break;
	case '2':Machine.show();break;
	case '3':Machine.select();break;
	case '4':Machine.alter();break;
	case '5':Machine.dele();break;
	case '6':VIP.inter_face();break;
    case '7':return;
	}
	}
}
void vip::inter_face()
{
   system("color 0c");
   char n;
    vip VIP;
	account Account;
	while(1)
	{
    system("cls");
    cout <<endl;
	cout<<"tt  O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nn";
    cout<<"tt╔*☆***◎***◇***☆*** 菜单 ***☆***◇***◎***☆*╗n";
    cout<<"tt|★|tt                       tt|★|n";
	cout<<"tt|☆|tt 1.管理员信息录入      tt|☆|n";
	cout<<"tt|★|tt 2.管理员信息显示      tt|★|n";
    cout<<"tt|☆|tt 3.管理员信息查询      tt|☆|n";
	cout<<"tt|★|tt 4.管理员信息修改      tt|★|n";
	cout<<"tt|☆|tt 5.管理员信息删除      tt|☆|n";
	cout<<"tt|★|tt 6.返回                tt|★|n";
	cout<<"tt|☆|tt                       tt|☆|n";
	cout<<"tt╚*☆***◎***◇****☆****★****☆****◇***◎***☆*╝nn";
    cout<<"tt请选择您要实现的功能选项 (1-6): [ ]bb";
	while(1)
	{
		cin>>n;getchar();
		if(n<'1'||n>'6')
			printf("输入错误,请您重新输入选项(1-6):[ ]bb");
		else
			break;
	}
    switch(n)
	{
    case '1':VIP.add();break;
	case '2':VIP.show();break;
	case '3':VIP.select();break;
	case '4':VIP.alter();break;
	case '5':VIP.dele();break;
    case '6':return;
	}
	}
}
void Get_xy(int x,int y)   //获取鼠标位置
{
    COORD pos;
    pos.X=x;
    pos.Y=y;
    HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hout,pos);
}
char account::home_face()
{
	system("color 0d");
    char n;
    system("cls");
    cout <<endl;
 
    for(int i=0;i<9;i++)   //出现闪动效果
    {
    Get_xy(8,4);
	if(i%2==0)  cout<<"t   O(∩_∩)O~~ 欢迎进入南阳康佳公司的设备管理系统nn";
	else cout<<endl<<endl;
    if(i%2==0) cout<<"tt╔*☆***◎***◇***☆*** 菜单 ***☆***◇***◎***☆*╗n";
    else cout<<endl;
    cout<<"tt|★|tt               ttt|★|n";
	if(i%2==0) cout<<"tt|☆|tt               ttt|☆|n";
    else cout<<endl;
	cout<<"tt|★|tt1.普通登录     ttt|★|n";
    cout<<"tt|☆|tt2.管理员登录   ttt|☆|n";
	cout<<"tt|★|tt3.VIP管理员登录ttt|★|n";
	cout<<"tt|☆|tt4.退出         ttt|☆|n";
    if(i%2==0)cout<<"tt|★|tt               ttt|★|n";
    else cout<<endl;
	cout<<"tt|☆|tt               ttt|☆|n";
	if(i%2==0)cout<<"tt╚*☆***◎***◇****☆****★****☆****◇***◎***☆*╝nn";
	else cout<<endl<<endl;
    cout<<"tt请选择您要实现的功能选项 (1-4): [ ]bb";
    Sleep(50); if(i<8)system("cls");
    }
	while(1)
	{
		cin>>n;getchar();
		if(n<'1'||n>'4')
			printf("输入错误,请您重新输入选项(1-4):[ ]bb");
		else
			return n;
	}
}
//添加设备
void machine::add()
{
     char m;
     bool flag=true;
     ifstream inData("e:\pbook.txt",ios::in);
     do
     {
    cout <<endl <<"根据下面提示添加新设备的信息" <<endl <<endl
        <<"编号 : " ;
    cin >>num;
    cout <<"类别 : ";
    do
    {
        cin >>category;
        if(category=="tv"||category=="dvd"||category=="tv_dvd") break;
        else
          cout<<"请输入tv或dvd或tv_dvd  " <<endl ;
    }while(1);
    cout <<"名称 : ";
    cin >>name;
    cout <<"价格 : ";
    cin >>price;
    cout <<"库存数量 : ";
    cin >>quantity;
    if (!inData)
    {
        flag=true;
    }
    string sign,str;
    while (inData>>sign)
    {
        getline(inData, str);
        if (num==sign)
        {
            flag = false;
        }
    }
    if(flag) save_new();
    else
    cout <<endl <<endl <<"设备编号已经存在,不能重复添加" <<endl <<endl;
    cout<<"t是否继续添加?(y/n):[ ]bb";
    cin>>m;
    if(m=='n') break;
    }while(1);
}
//添加管理员
void vip::add()
{
     char m;
     bool flag=true;
     ifstream inData("e:\Document.txt",ios::in);
     do
     {
    cout <<endl <<"根据下面提示添加新管理员的信息" <<endl <<endl
        <<"账号 : " ;
    cin >>id;
    cout<<"密码 : ";
    cin >>password;
    if (!inData)
    {
        flag=true;
    }
    string sign,str;
    while (inData>>sign>>str)
    {
        if (id==sign)
        {
            flag = false;
        }
    }
    if(flag) save_new();
    else
    cout <<endl <<endl <<"管理员号已经存在,不能重复添加" <<endl <<endl;
    cout<<"t是否继续添加?(y/n):[ ]bb";
    cin>>m;
    if(m=='n') break;
    }while(1);
}
//删除设备
void machine::dele()
{
    ofstream outData("e:\temp.txt", ios::out);
    ifstream inData("e:\pbook.txt", ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
        system("pause");
        return;
    }
    string sign;
    cout <<endl <<"你要删除设备的编号 :";
    cin >>sign;
    string str1;
    bool flag = true;
    string str;
    while(inData>>num)
    {
        getline(inData,str);
        if(sign==num)
        {
            cout <<endl <<"你想删除的设备:" <<endl <<endl;
			cout<<H<<H1<<H2;
            cout<<setw(10)<<num<<str<<endl;
	        cout<<H2;
            flag = false;
            break;
        }
        outData<<setiosflags(ios::left)<<num<<setw(10)<<str<<endl;
    }
    if (flag)
    {
        cout <<endl <<"对不起!!!没有你找的设备!!!!" <<endl <<endl;
    }
    else
    {
        while (getline(inData, str))
        {
            outData<<str<<endl;
        }
        outData.close();
        inData.close();
        ofstream out("e:\pbook.txt", ios::out);
        ifstream in("e:\temp.txt", ios::in);
        if (!out||!in)
        {
            cout <<endl <<"对不起,不能打开文件!!!" <<endl <<endl;
            system("pause");
            return;
        }
        while (getline(in,str))
        {
            out<<str<<endl;
        }
        out.close();
        in.close();
        cout <<endl <<"这个设备的信息已经删除!!!" <<endl <<endl;
    }
    system("pause");
}
//删除管理员
void vip::dele()
{
    ofstream outData("e:\temp1.txt", ios::out);
    ifstream inData("e:\Document.txt", ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
        system("pause");
        return;
    }
    string sign;
    cout <<endl <<"你要删除管理员的帐号 :";
    cin >>sign;
    string str1;
    bool flag = true;
    string str;
    while(inData>>id)
    {
        getline(inData,str);
        if(sign==id)
        {
            cout <<endl <<"你想删除的管理员:" <<endl <<endl;
			cout<<H3<<H4<<H5;
            cout<<setw(10)<<id<<str<<endl;
			cout<<H5;
            flag = false;
            break;
        }
        outData<<setiosflags(ios::left)<<id<<setw(10)<<str<<endl;
    }
    if (flag)
    {
        cout <<endl <<"对不起!!!没有你找的管理员信息!!!!" <<endl <<endl;
    }
    else
    {
        while (getline(inData, str))
        {
            outData<<str<<endl;
        }
        outData.close();
        inData.close();
        ofstream out("e:\Document.txt", ios::out);
        ifstream in("e:\temp1.txt", ios::in);
        if (!out||!in)
        {
            cout <<endl <<"对不起,不能打开文件!!!" <<endl <<endl;
            system("pause");
            return;
        }
        while (getline(in,str))
        {
            out<<str<<endl;
        }
        out.close();
        in.close();
        cout <<endl <<"这个管理员的信息已经删除!!!" <<endl <<endl;
    }
    system("pause");
}
//显示所有信息
void machine::show()
{
    ifstream inData("e:\pbook.txt",ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!!!!没有找到文件!!!!!" <<endl;
        system("pause");
        return;
    }
    bool flag = true;
    string record;
    while (getline(inData, record))
    {
        if (flag)
        {
            cout <<endl <<"所有设备信息如下: "<<endl;
			cout<<H<<H1<<H2;
        }
 
        cout <<record<<endl;
		cout<<H2;
        flag = false;
    }
 
    if (flag)
    {
        cout <<endl <<"系统中没有设备信息!!!!!" <<endl <<endl;
    }
    else
    {
        cout <<endl <<"所有设备信息已经全部显示出来!!!!!" <<endl <<endl;
    }
 
    system("pause");
}
void vip::show()
{
    ifstream inData("e:\Document.txt",ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!!!!没有找到文件!!!!!" <<endl;
        system("pause");
        return;
    }
    bool flag = true;
    string record;
    while (getline(inData, record))
    {
        if (flag)
        {
            cout <<endl <<"所有管理员信息如下: "<<endl;
			cout<<H3<<H4<<H5;
        }
        cout <<record<<endl;
		cout<<H5;
        flag = false;
    }
 
    if (flag)
    {
        cout <<endl <<"系统中没有管理员信息!!!!!" <<endl <<endl;
    }
    else
    {
        cout <<endl <<"所有管理员信息已经全部显示出来!!!!!" <<endl <<endl;
    }
 
    system("pause");
}
//修改信息
void machine::alter()
{
    ofstream outData("e:\temp.txt", ios::out);
    ifstream inData("e:\pbook.txt", ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
        system("pause");
        return;
    }
    string sign;
    cout <<endl <<"你要修改设备的编号 :";
    cin >>sign;
    bool flag = true;
    string str;
    while (inData>>num)
    {
        getline(inData, str);
        if (sign==num)
        {
            cout <<endl <<"你想修改的设备信息:" <<endl <<endl;
			cout<<H<<H1<<H2;
            cout<<setw(10)<<num<<str<<endl;
			cout<<H2;
            cout <<endl <<"请根据下面提示修改信息 : " <<endl;
            cout<<"编号 : " ;
            cin >>num;
            cout <<"类别 : ";
            cin >>category;
            cout <<"名称 : ";
            cin >>name;
            cout <<"价格 : ";
            cin >>price;
            cout <<"库存数量 : ";
            cin >>quantity;
            save_new();
            flag = false;
            break;
        }
        outData<<setiosflags(ios::left)<<num<<setw(10)<<str<<endl;
    }
    if (flag)
    {
        cout <<endl <<"对不起!!!没有找到这个设备!!!!" <<endl <<endl;
    }
    else
    {
        while(getline(inData, str))
        {
            outData <<str <<endl;
        }
        outData.close();
        inData.close();
        ofstream out("e:\pbook.txt", ios::out);
        ifstream in("e:\temp.txt", ios::in);
        if (!out||!in)
        {
            cout <<endl <<"对不起不能打开文件!!!" <<endl <<endl;
            system("pause");
            return;
        }
        while (getline(in, str))
        {
            out <<str <<endl;
        }
        out.close();
        in.close();
        cout <<endl <<"这个设备的信息已经修改!!!" <<endl <<endl;
    }
    system("pause");
}
void vip::alter()
{
    ofstream outData("e:\temp1.txt", ios::out);
    ifstream inData("e:\Document.txt", ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
        system("pause");
        return;
    }
    string sign;
    cout <<endl <<"你要修改管理员的帐号 :";
    cin >>sign;
    bool flag = true;
    string str;
    while (inData>>id)
    {
        getline(inData, str);
        if (sign==id)
        {
            cout <<endl <<"你想修改的管理员信息:" <<endl <<endl;
			cout<<H3<<H4<<H5;
            cout<<setw(10)<<id<<str<<endl;
			cout<<H5;
            cout <<endl <<"请根据下面提示修改信息 : " <<endl;
            cout<<"帐号 : " ;
            cin >>id;
            cout <<"密码 : ";
            cin >>password;
            save_new();
            flag = false;
            break;
        }
        outData<<setiosflags(ios::left)<<id<<setw(10)<<str<<endl;
    }
    if (flag)
    {
        cout <<endl <<"对不起!!!没有找到这个管理员信息!!!!" <<endl <<endl;
    }
    else
    {
        while(getline(inData, str))
        {
            outData <<str <<endl;
        }
        outData.close();
        inData.close();
        ofstream out("e:\Document.txt", ios::out);
        ifstream in("e:\temp1.txt", ios::in);
        if (!out||!in)
        {
            cout <<endl <<"对不起不能打开文件!!!" <<endl <<endl;
            system("pause");
            return;
        }
        while (getline(in, str))
        {
            out <<str <<endl;
        }
        out.close();
        in.close();
        cout <<endl <<"这个设备的信息已经修改!!!" <<endl <<endl;
    }
    system("pause");
}
//查询设备
void machine::select()
{
    ifstream inData("e:\pbook.txt",ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!文件找不到" <<endl;
        system("pause");
        return;
    }
    string sign;
    cout <<endl <<"输入你想查找的设备编号: ";
    cin >>sign;
    string str1;
    bool flag =true;
    string str;
    while (inData>>num)
    {
        getline(inData, str);
        if (num==sign)
        {
            cout <<endl <<"你要查找的设备是: " <<endl <<endl;
			cout<<H<<H1<<H2;
            cout <<setw(10)<<num<<str<<endl;
			cout<<H2;
            flag = false;
            system("pause");
            break;
        }
    }
    if(flag)
    {
        cout <<endl <<"你要查找的设备不存在!" <<endl <<endl;
        system("pause");
    }
}
void vip::select()
{
   ifstream inData("e:\Document.txt",ios::in);
    if (!inData)
    {
        cout <<endl <<"对不起!文件找不到" <<endl;
        system("pause");
        return;
    }
    string sign;
    cout <<endl <<"输入你想查找的管理员帐号: ";
    cin >>sign;
    string str1;
    bool flag =true;
    string str;
    while (inData>>id)
    {
        getline(inData, str);
        if (id==sign)
        {
            cout <<endl <<"你要查找的管理员信息是: " <<endl <<endl;
			cout<<H3<<H4<<H5;
            cout<<setw(10)<<id<<str<<endl;
			cout<<H5;
            flag = false;
            system("pause");
            break;
        }
    }
    if(flag)
    {
        cout <<endl <<"你要查找的管理员信息不存在!" <<endl <<endl;
        system("pause");
    }
}
void machine::save_new()
{
    ofstream outData("e:\pbook.txt", ios::app);
    if (!outData)
    {
        cout <<endl <<"对不起!!!打开文件失败!!!!" <<endl <<endl;
        system("pause");
        return;
    }
	outData	<<setw(10)<<num
        <<" " << setw(10) <<category <<" "
        <<setw(10)<< name <<" "
        <<setw(10)<<price<<" "
        <<setw(10)<<quantity
        <<endl;
    outData.close();
}
void vip::save_new()
{
    ofstream outData("e:\Document.txt", ios::app);
    if (!outData)
    {
        cout <<endl <<"对不起!!!打开文件失败!!!!" <<endl <<endl;
        system("pause");
        return;
    }
    outData<<setw(10)<<id
        <<" " << setw(10) <<password <<" "<<endl;
    outData.close();
}
int main()
{
    machine Machine;
    account Account;
	admin Admin;
	vip VIP;
    while(1)
    {
      switch(Account.home_face())
      {
         case '1':Account.entrance();break;
	     case '2':Admin.admin_enter();break;
		 case '3':VIP.vip_enter();break;
		 case '4': MessageBox(NULL,"  Thanks for you!! nn tt---Made by hrdv t  ","☆Bye☆Bye☆",0);return 0;//弹框
      }
    }
}
内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/Noiimplant/p/17571048.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程

4484 9.9元 19.8元 5折