4s店管理系统

一、面向对象程序设计课程设计目的
面向对象程序设计是学习完《面向对象程序设计》课程后进行的一次全面的综合练习。本课程全面系统的学习面向对象程序设计的基本概念,基本语法和编程方法。正确理解掌握C++面向对象程序设计的基本特性:类,对象,继承与派生,流类库,培养掌握成学设计的基本思路和方法。加强研发、调试程序的能力,增强分析、解决问题的能力。。最终,达到了提高本课程综合实践能力的目的。
二、设计过程及步骤
1、问题分析与功能定义
针对汽车的进、销、存、维修、利润结算等4S店日常管理,我认为4s店应该分为两个部分,工作人员和顾客,工作人员负责职员模块,对职员进行操作,汽车模块,进车,修改车价,增加车的种类,订单模块,查询现在已有的订单,利润看现在的利润顾客选择购车,修车,和查询自己的会员等级.购车根据给出的现有汽车种类完成,修车因为顾客并不能知道自己哪里坏了,所以根据维修等级收费,查询自己的等级,没有信息写入信息
5、测试与调试
1.连续增加职员信息,系统出错,在if语句中构建对象,在if结束后释放,解决方法为在最开始声明一个多于对象数量的数组,之后修改空对象,达到构建新对象的功能.
2.在职员模块查找订单的时候,查找情况的订单为空时没有输出,增加标记,标记为空,输出暂无订单 .
3.顾客买完车之后,车的数量没有少,忘记减少车的数量了.
4.不按照要求输入,系统崩溃,不按照要求输入,返回错误,并询问是否还需要自己操作
5.读入文件出错,读文件从上次读入的位置继续读入,修改读文件文章,或者关闭文件再打开.
6、结论
现在已经完成,对职员进行操作,增,改,查,进车,修改车价,增加车的种类,查询现在已有的订单,利润看现在的利润,顾客选择购车,修车,和查询自己的会员等级.购车根据给出的现有汽车种类完成,输入错误返回,和输入结束.未来数组可以使用动态数组,不用文本存入数据改为数据库,使用一些框架,使程序更加完善.
code::block下完成

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<fstream>
#include <map>
using namespace std;
int totalprofit=0;//总利润
int repaiprofit=0;//维修利润
fstream ccin("职员信息表.txt",ios::in);
fstream ccout("职员信息表.txt",ios::out);
fstream oin("订单信息表.txt",ios::in);
fstream oout("订单信息表.txt",ios::out);
//void outcarprice();//将汽车价目表输入文本,可修改函数添加更多汽车种类
//void outcrarprice();//将各部分价目表输入文本,可修改函数添加更多种类
ostream &out(ostream &stream);//格式输出,内容为空格
double discount[]= {1,0.9,0.8,0.7}; //根据客户等级选择折扣
class date//日期类
{
private:
    int year;//年
    int month;//月
    int day;//日
public:
    void set_date(int a,int b,int c);//日期类的修改函数
    date(int a,int b,int c);//日期类的构造函数
    date();//空构造函数
    void show_date();//打印date类的信息
    int get_year();//拿出year;
    int get_month();//拿出month
    int get_day();//拿出day
};//日期类
class people//人类
{
protected:
    string name;//名字
    string number;//编号
    string  sex;//性别
public:

    void set_people(string a,string b,string c);//修改人类
    people(string a,string b,string c);//人类的构造函数
    people();//人类的空构造函数
    void show_people();//打印人类的数据
    string get_name();//拿出名字
    string get_number();//拿出编号
    string get_sex();//拿出性别
};
class consumer: public people//消费者类共有继承人类
{
    int level;//会员等级
    string phonenumber;//手机号

public:
    void  set_consumer(string a,string b,string c,int d,string e);//修改顾客类,把空的修改为有信息的
    consumer(string a,string b,string c,int d,string e);//顾客类的构造函数
    consumer();//空构造函数
    void show_consumer();//打印消费者类的信息
    string  get_name();//拿出名字
    string get_number();
    string get_sex();
    int get_level();
    string get_phonenumber();
    static int quantity;//现有顾客信息数量
};//顾客类
class clerk: public people
{
    string position;//职位
public:
    set_position(string a,string b,string c,string d);//修改店员
    clerk(string a,string b,string c,string d);//店员类的构造函数
    clerk();
    ~ clerk();//析构函数
    void show_clerk();//打印职员信息
    string get_name();//得到名字
    string get_number();//得到编号
    string get_sex();//得到性别
    string get_position();//得到职位
    void set_cherk(string a,string b,string c,string d);//修改员工,空变有
    void txt_cherk();
    static int quantity;//员工数量
};//店员类
class  car//汽车类
{
    string name;//名字
    int price;//价格
    int number;//数量
public:
    car(string a,int  b,int c);//构造函数
    void set_car(string a,int  b,int c);//把空的赋值,故种类加1
    car();//空构造函数
    show_car();//打印车的信息
    void set_number(int a);//把车的数量拿出来修改,加a
    string get_name();//把车名拿出来
    int& get_price();//修改车价格,引用可以直接修改
    static int quantity;//汽车种类
};//汽车类
class order//订单类
{
private:
    string consumer_name ;//消费者名字
    string car_name;//汽车名字
    string cherk_name;//职员名字
    date D;//时间
public:
    order(string a,string b,string c,int d,int e,int f);//构造函数,嵌入时间类
    order();//空构造函数
    void  show_order();//打印订单
    void set_order( string a,string b,string c,int d,int e,int f);//把空订单修改为非空
    string  get_car_name();//得到汽车名字
    string  get_consumer_name();//得到消费者名字
    string  get_cherk_name();//得到职员名字
    int get_year();//年
    int get_month();//月
    int get_day();//日
    static int quantity;
};
class repair//维修类,汽车零件太多,故改为1,2,3级别维修
{
    string name;
    int price;
public:
    repair(string a,int b);//构造函数
    repair();//空构造函数
    void set_repair(string a,int b);//修改维修
    string get_name();//得到名字
    int  get_price();//得到价格
    void  show_repair();//打印维修信息
    static int quantity;
};
int car::quantity=0;//汽车种类初始为零
int clerk::quantity=0;//职员数量初始为零
int consumer::quantity=0;//顾客信息数量初始为零
int order::quantity=0;//订单数量初始为零
int repair::quantity=0;//维修种类初始数量为零
int main()
{
    clerk xx[10]=//默认植入三个职员
    {
        clerk("王一伟","001","男","总管"),
        clerk("王二伟","002","男","经理"),
        clerk("王三伟","003","男","员工")

    };
    car yy[10]=//默认置入车辆名字,价格和数量
    {
        car("宝马",60000,1),
        car("奇骏",190000,1),
        car("MINI",200000,1),
        car("威驰",80000,1),
        car("瑞纳",50000,1),
        car("宝骏",40000,1),
        car("悦翔",60000,1)

    };
    repair zz[5]=//默认维修方式
    {
        repair("一级维护",60000),
        repair("二级维护",190000),
        repair("三级维护",290000),
        repair("汽车保养",80000)
    };
    consumer ll[10]=//默认顾客信息
    {
        consumer ("一家伟","001","男",1,"188845613950"),
        consumer ("二家伟","002","男",2,"18845613955"),
        consumer ("三家伟","003","男",3,"18845603952")
    };
    order uu[20]=//默认订单
    {
        order("一家伟","宝马","王一伟",2021,7,6),
        order("二家伟","奇骏","王二伟",2021,7,6),
        order("三家伟","奇骏","王三伟",2021,7,5)
    };
    totalprofit+=60000*0.9;//三个默认订单的利润
    totalprofit+=190000*0.8;
    totalprofit+=190000*0.7;
    //outcarprice();
    //outcrarprice();
x://程序主界面
    system("cls");
    cout<<"                        *************************************"<<endl<<endl;
    cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
    cout<<"                        *************************************"<<endl;
    cout<<"                        +---------------------------------+" << endl;
    cout<<"                        |1.工作人员                       |\n";
    cout<<"                        |2.顾客                           |\n";
    cout<<"                        |3.退出                           |\n";
    cout<<"                        +---------------------------------+" << endl;
    cout<<"                         请输入你的身份:";
    int x;
    cin>>x;
    if(x==1)//工作人员模块
    {
x1:
        system("cls");
        cout<<"                        *************************************"<<endl<<endl;
        cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
        cout<<"                        *************************************"<<endl;
        cout<<"                        ------------------------------------\n";
        cout<<"                        |          1.  职员模块             |\n";
        cout<<"                        |          2.  汽车模块             |\n";
        cout<<"                        |          3.  订单模块             |\n";
        cout<<"                        |          4.  利润模块             |\n";
        cout<<"                        |          5.  返回                 |\n";
        cout<<"                        |          6.  退出                 |\n";
        cout<<"                        ------------------------------------\n";
        cout<<"                        请输入(1-5)否则无效! 请输入您的选择:";
        int x1;
        cin>>x1;//选择模块
        if(x1==1)//职员模块
        {
x11://第一次选择返回点,两次都选择1,命名x11
            system("cls");
            cout<<"                        *************************************"<<endl<<endl;
            cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
            cout<<"                        *************************************"<<endl;
            cout<<out<<"姓名"<<"    "<<"编号"<<"    "<<"性别"<<"    "<<"职位"<<endl;
            int n=clerk::quantity;
            for(int i=0; i<n; i++)//输出全部职员信息
            {
                xx[i].show_clerk();
            }
            cout<<out<<"新增1   更改2  查找3 返回4 退出5"<<endl;
            int x11;
            cout<<out<<"请输入你要进行的操作:";
            cin>>x11;
            if(x11==1)//新增职员
            {
                cout<<out<<"请输入一个职员信息,例如"<<endl;
                cout<<out<<" 王一伟 001 男 总管"<<endl;
                cout<<out<<"职员信息:";
                string a;
                string b;
                string c;
                string d;
                cin>>a>>b>>c>>d;
                int n=clerk::quantity;
                xx[n].set_cherk(a,b,c,d);//修改职员

            }
            else  if(x11==2)//修改职员
            {
                cout<<out<<"请输入一个职员名字,例如"<<endl;
                cout<<out<<" 王一伟"<<endl;
                cout<<out<<"职员名字:";
                string x;//员工名字
                cin>>x;
                string a,b,c,d;
                a=x;
                int n=clerk::quantity;
                // cout<<clerk::quantity;
                for(int i=0; i<n; i++)//找到要修改的职员
                {

                    string xxx=xx[i].get_name();
                    if(xxx==a)
                    {
                        cout<<out<<"请输入他更改后的编号:";
                        cin>>b;
                        cout<<out<<"请输入他更改后的性别:";
                        cin>>c;
                        cout<<out<<"请输入他更改后的职位:";
                        cin>>d;
                        xx[i].set_cherk(a,b,c,d);
                        clerk::quantity--;
                        break;
                    }

                }



            }
            else  if(x11==3)//查找模块
            {
                cout<<out<<"请输入一个职员名字,例如"<<endl;
                cout<<out<<" 王一伟"<<endl;
                cout<<out<<"职员名字:";
                string x;//员工名字
                cin>>x;
                string a,b,c,d;
                a=x;
                int n=clerk::quantity;
                // cout<<clerk::quantity;
                for(int i=0; i<n; i++)//找到要查找的职员
                {

                    string xxx=xx[i].get_name();
                    if(xxx==a)
                    {

                        xx[i].show_clerk();

                        break;
                    }

                }


            }
            else if(x11==4)//返回
            {
                goto x1;
            }
            else if (x11==5)//结束
            {
                return 0;
            }
            else//输入不符合规范,返回
            {
                cout<<out<<"输入错误,输入y继续操作,其他退出"<<endl;
                char  ss;
                cout<<out<<"请输入:";
                cin>>ss;
                if(ss=='y')
                    goto  x11;
            }
            //每次操作结束询问是否还要操作
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto x11;
        }
        else if(x1==2)//汽车模块
        {
x12:
            system("cls");
            cout<<"                        *************************************"<<endl<<endl;
            cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
            cout<<"                        *************************************"<<endl;
            cout<<out<<"现有汽车情况"<<endl;
            cout<<out<<"种类  价格   数量"<<endl;
            int n=car::quantity;
            for(int i=0; i<n; i++)//输出现有汽车情况
                yy[i].show_car();

            cout<<"                        ------------------------------------\n";
            cout<<"                        |          1.  进车入店             |\n";
            cout<<"                        |          2.  修改车价             |\n";
            cout<<"                        |          3.  加车的种类           |\n";
            cout<<"                        |          4.  返回                 |\n";
            cout<<"                        |          5.  退出                 |\n";
            cout<<"                        ------------------------------------\n";
            cout<<"                        请输入(1-5)否则无效! 请输入您的选择:";
            int x12;
            cin>>x12;
            if(x12==1)//进车入店
            {
                cout<<out<<"请输入车辆,数量"<<endl;
                cout<<out<<"例如 宝马 5"<<endl;
                string a;
                int b;
                cout<<out<<"请输入:";
                cin>>a>>b;
                for(int i=0; i<n; i++)//找到你要修改的汽车,进行修改,并把修改后的输出
                {
                    if(a==yy[i].get_name())
                    {
                        yy[i].set_number(b);
                        cout<<out<<"修改后汽车情况"<<endl;
                        cout<<out<<"种类  价格   数量"<<endl;
                        int n=car::quantity;
                        for(int i=0; i<n; i++)//输出修改后的车况
                            yy[i].show_car();
                        break;
                    }
                }
            }
            else  if(x12==2)//修改车价
            {
                cout<<out<<"请输入车辆,价格"<<endl;
                cout<<out<<"例如 宝马 500000"<<endl;
                string a;
                int b;
                cout<<out<<"请输入:";
                cin>>a>>b;
                for(int i=0; i<n; i++)//找到你要修改的汽车,进行修改,并把修改后的输出
                {
                    if(a==yy[i].get_name())
                    {
                        yy[i].get_price()=b;
                        cout<<out<<"修改后汽车情况"<<endl;
                        cout<<out<<"种类  价格   数量"<<endl;
                        int n=car::quantity;
                        for(int i=0; i<n; i++)
                            yy[i].show_car();
                        break;
                    }
                }
            }
            else if(x12==3)//增加车的种类
            {
                cout<<out<<"请输入车辆,价格,数量"<<endl;
                cout<<out<<"例如 奔驰 500000   5"<<endl;
                string a;
                int b;
                int c;
                cout<<out<<"请输入:";
                cin>>a>>b>>c;
                yy[n].set_car(a,b,c);//在空的函数里面修改
                cout<<out<<"增加后汽车情况"<<endl;
                cout<<out<<"种类  价格   数量"<<endl;
                int n=car::quantity;
                for(int i=0; i<n; i++)
                    yy[i].show_car();

            }
            else  if(x12==4)//返回
            {
                goto x1;
            }
            else if(x12==5)//结束
            {
                return 0;
            }
            else//输出不符合规范,返回
            {
                cout<<out<<"输入错误,输入y继续操作,其他退出"<<endl;
                char  ss;
                cout<<out<<"请输入:";
                cin>>ss;
                if(ss=='y')
                    goto  x12;
            }
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto x12;
        }

        else if(x1==3)//订单模块
        {
            int flag=0;//用来标记订单是否存在
x13:
            system("cls");
            cout<<"                        *************************************"<<endl<<endl;
            cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
            cout<<"                        *************************************"<<endl;
            if(!order::quantity)//订单数量为0
            {
                cout<<out<<"订单为空,返回上一级"<<endl;
                goto  x1;

            }
            else
            {
                string a;
                string b;
                string c;
                int d;
                int e;
                int f;
                cout<<out<<"现有订单如下:"<<endl;
                for(int i=0; i<order::quantity; i++)//输出全部订单
                {
                    uu[i].show_order();
                }
                cout<<"                        ------------------------------------\n";
                cout<<"                        |          1.  顾客名字查找         |\n";
                cout<<"                        |          2.  职员名字查找         |\n";
                cout<<"                        |          3.  订单时间查找         |\n";
                cout<<"                        |          4.  返回                 |\n";
                cout<<"                        |          5.  退出                 |\n";
                cout<<"                        ------------------------------------\n";
                cout<<"                        请输入(1-5)否则无效! 请输入您的选择:";

                int x13;
                cin>>x13;

                if(x13==1)//顾客名字查找
                {
                    cout<<out<<"输入你要查找的顾客姓名 "<<endl;
                    cout<<out<<"  例如  一家伟"<<endl;
                    cout<<out<<"请输入:";
                    string x;
                    cin>>x;
                    for(int i=0; i<order::quantity; i++)//找到订单并输出
                    {
                        a=uu[i].get_consumer_name();
                        b=uu[i].get_car_name();
                        c=uu[i].get_cherk_name();
                        d=uu[i].get_year();
                        e=uu[i].get_month();
                        f=uu[i].get_day();
                        if(x==a)
                        {
                            flag=1;//有订单
                            cout<<a<<"  "<<b<<"  "<<c<<"  "<<d<<"."<<e<<"."<<f<<endl;
                        }
                    }
                    if(flag==0)//订单为空
                        cout<<out<<"暂无订单"<<endl;

                }
                else if(x13==2)//职员名字查找
                {
                    cout<<out<<"输入你要查找的店员姓名 "<<endl;
                    cout<<out<<"  例如  一家伟"<<endl;
                    string x;
                    cout<<out<<"请输入:";
                    cin>>x;

                    for(int i=0; i<order::quantity; i++)//输出订单信息
                    {
                        a=uu[i].get_consumer_name();
                        b=uu[i].get_car_name();
                        c=uu[i].get_cherk_name();
                        d=uu[i].get_year();
                        e=uu[i].get_month();
                        f=uu[i].get_day();
                        if(x==c)
                        {
                            flag=1;//有订单
                            cout<<out<<a<<"  "<<b<<"  "<<c<<"  "<<d<<"."<<e<<"."<<f<<endl;
                        }
                    }
                    if(flag==0)//订单为空
                        cout<<out<<"暂无订单"<<endl;
                }
                else if(x13==3)//订单时间查找
                {
                    cout<<out<<"输入你要查找的时间 "<<endl;
                    cout<<out<<"  例如  2021 7  5"<<endl;
                    int x,y,z;
                    cout<<out<<"请输入:";
                    cin>>x>>y>>z;
                    for(int i=0; i<order::quantity; i++)//找到订单并输出
                    {
                        a=uu[i].get_consumer_name();
                        b=uu[i].get_car_name();
                        c=uu[i].get_cherk_name();
                        d=uu[i].get_year();
                        e=uu[i].get_month();
                        f=uu[i].get_day();
                        if(x==d&&y==e&&z==f)
                        {
                            flag=1;//有订单
                            cout<<out<<a<<"  "<<b<<"  "<<c<<"  "<<d<<"."<<e<<"."<<f<<endl;
                        }
                    }
                    if(flag==0)//订单为空
                        cout<<out<<"暂无订单"<<endl;
                }
                else if(x13==4)//返回
                {

                    goto x1;
                }
                else if(x13==5)//退出
                {
                    return  0;
                }
                else//输入错误
                {
                    cout<<out<<"输入错误,输入y继续操作,其他退出"<<endl;
                    char  ss;
                    cout<<out<<"请输入:";
                    cin>>ss;
                    if(ss=='y')
                        goto  x13;
                }
            }

            //每次操作结束询问是否还要操作
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto x13;
        }
        else if(x1==4)//利润模块
        {


            cout<<"                        ------------------------------------\n";
            cout<<out<<"总利润为:"<<totalprofit<<endl;
            cout<<out<<"修理利润为:"<<repaiprofit<<endl;
            cout<<out<<"卖车利润为:"<<totalprofit-repaiprofit<<endl;
            cout<<"                        ------------------------------------\n";
            //每次操作结束询问是否还要操作
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto x1;
        }
        else if(x1==5)//返回
        {
            goto x;
        }
        else if(x1==6)//结束
        {
            return 0;
        }
        else//输入错误,返回
        {
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto  x1;
        }
    }
    else if(x==2)//顾客模块
    {
x2:
        system("cls");//清空屏幕
        cout<<"                        *************************************"<<endl<<endl;
        cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
        cout<<"                        *************************************"<<endl;
        cout<<"                        ------------------------------------\n";
        cout<<"                        |          1.  购车模块             |\n";
        cout<<"                        |          2.  维修模块             |\n";
        cout<<"                        |          3.  查询模块             |\n";
        cout<<"                        |          4.  返回                 |\n";
        cout<<"                        |          5.  退出                 |\n";
        cout<<"                        ------------------------------------\n";
        cout<<"                        请输入(1-5)否则无效! 请输入您的选择:";
        int x;
        cin>>x;
        if(x==1)
        {
x21:
            system("cls");//清空屏幕
            cout<<"                        *************************************"<<endl<<endl;
            cout<<"                        *         汽车4S店管理系统          *"<<endl<<endl;;
            cout<<"                        *************************************"<<endl;
            double cou;//折扣
            int price;//价格

            cout<<out<<"现有汽车价格数量如下"<<endl;
            int n=car::quantity;
            cout<<"                        ------------------------------------\n";
            for(int i=0; i<n; i++)
                yy[i].show_car();
            cout<<"                        ------------------------------------\n";
            cout<<out<<"请输入你想要的车的种类"<<endl;
            cout<<out<<"例如  宝马"<<endl;
            cout<<out<<"请输入";
            string xx;
            cin>>xx;
            int flag=0;
            for(int i=0; i<n; i++)
            {
                string x=yy[i].get_name();
                if(x==xx)
                {
                    price=yy[i].get_price();
                    flag=1;
                    yy[i].set_number(-1);
                    break;
                }
            }
            if(flag==0)//没有找到车
            {
                cout<<out<<"没有这种车,请换一辆"<<endl;
                cout<<out<<"输入y继续操作,其他退出"<<endl;
                char  ss;
                cout<<out<<"请输入:";
                cin>>ss;
                if(ss=='y')
                    goto x21;
            }
            flag=0;
            cout<<out<<"请输入你的名字:";
            string yy;
            cin>>yy;

            int nn=consumer::quantity;

            for( int i=0; i<nn; i++)//根据会员等级算价格
            {
                string x;
                x=ll[i].people::get_name();
                if(x==yy)
                {
                    flag=1;
                    cout<<out<<"你的会员等级为"<<ll[i].get_level()<<endl;
                    int n=ll[i].get_level();
                    cout<<out<<"你的折扣为"<<discount[n]<<endl;
                    cou=discount[n];
                    break;
                }
            }

            if(flag==0)//店内没有信息,存入信息
            {

                string a;
                string b;
                string c;
                int d;
                string e;
                cout<<out<<"您不是本店的会员"<<endl;
                cout<<out<<"请输入你的名字   ";
                cout<<"例如 一家伟"<<endl;
                cout<<out<<"请输入:";
                cin>>a;
                b="000";
                b[2]=consumer::quantity+49;
                cout<<out<<"请输入你的性别 男 女   ";
                cin>>c;
                cout<<out<<" 请输入你的会员等级0 1 2 3   ";
                cin>>d;
                cou=discount[d];
                cout<<out<<"输入你的手机号:";
                cin>>e;
                int nnn=consumer::quantity;
                ll[nnn]. set_consumer(a,b,c,d,e);
                cout<<out<<"您的信息已存储"<<endl;
            }
            string f;
            cout<<out<<"请输入你的导购员:";


            cin>>f;
            int aa,bb,cc;
            cout<<out<<"请输入日期:如2002 03 23"<<endl;
            cout<<out<<"请输入:";
            cin>>aa>>bb>>cc;
            int nnnn=order::quantity;
            uu[nnnn].set_order(yy,xx,f,aa,bb,cc);
            totalprofit+=price*cou;
            cout<<out<<"折扣后您一共消费"<<price*cou<<endl;


            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  s;
            cout<<out<<"请输入:";
            cin>>s;
            if(s=='y')
                goto x2;
        }
        else if(x==2)//维修
        {
            double cou;//折扣
            int price;
x22:
            cout<<out<<"现有维护价格如下"<<endl;
            int n=repair::quantity;
            cout<<"                        ------------------------------------\n";
            for(int i=0; i<n; i++)
                zz[i].show_repair();
            cout<<"                        ------------------------------------\n";
            cout<<out<<"请输入你想要的维护的种类"<<endl;
            cout<<out<<"例如  一级维护"<<endl;
            cout<<out<<"请输入:";
            string xx;
            cin>>xx;
            int flag=0;
            for(int i=0; i<n; i++)//找到你要进行的维修
            {
                string x=zz[i].get_name();
                if(x==xx)
                {
                    price=zz[i].get_price();
                    flag=1;
                    break;
                }
            }
            if(flag==0)//没找到你要进行的维修
            {
                cout<<out<<"没有这种维护,请换一种"<<endl;
                cout<<out<<"输入y继续操作,其他退出"<<endl;
                char  ss;
                cout<<out<<"请输入:";
                cin>>ss;
                if(ss=='y')
                    goto x22;
                else
                    return 0;
            }
            flag=0;
            cout<<out<<"请输入你的名字:";
            string yy;
            cin>>yy;

            int nn=consumer::quantity;

            for( int i=0; i<nn; i++)//找到你的名字,进而找到信息
            {
                string x;
                x=ll[i].people::get_name();
                if(x==yy)
                {
                    flag=1;
                    cout<<out<<"你的会员等级为"<<ll[i].get_level()<<endl;
                    int n=ll[i].get_level();
                    cout<<out<<"你的折扣为"<<discount[n]<<endl;
                    cou=discount[n];
                    break;
                }
            }

            if(flag==0)//没找到名字
            {
                string a;
                string b;
                string c;
                int d;
                string e;
                cout<<out<<"您还不是本店的会员"<<endl;
                cout<<"请输入你的名字   ";
                cin>>a;
                b="000";
                b[2]=consumer::quantity+49;
                cout<<out<<"请输入你的性别 男 女   ";
                cin>>c;
                cout<<out<<" 请输入你的会员等级0 1 2 3   ";
                cin>>d;
                cou=discount[d];
                cout<<out<<"输入你的手机号:";
                cin>>e;
                int nnn=consumer::quantity;
                ll[nnn]. set_consumer(a,b,c,d,e);
                cout<<out<<"信息已存储"<<endl;
            }
            totalprofit+=price*cou;//计算利润
            repaiprofit+=price*cou;//计算利润
            cout<<out<<"折扣后您一共消费"<<price*cou<<endl;
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto x2;
        }
        else if(x==3)//根据名字查找信息
        {
            cout<<out<<"请输入你的名字:";
            string yy;
            cin>>yy;
            int nn=consumer::quantity;
            int flag=0;
            for( int i=0; i<nn; i++)
            {
                string x;
                x=ll[i].people::get_name();
                if(x==yy)
                {
                    flag=1;
                    cout<<out<<"你的会员等级为:"<<ll[i].get_level()<<endl;
                    int n=ll[i].get_level();
                    cout<<out<<"你的折扣为:"<<discount[n]<<endl;
                    break;
                }
            }

            if(flag==0)//没有查到,写入信息
            {
                cout<<out<<"查无此人"<<endl;
                string a;
                string b;
                string c;
                int d;
                string e;
                cout<<out<<"请再输入你的名字  :";
                cin>>a;
                b="000";
                b[2]=consumer::quantity+49;
                cout<<out<<"请输入你的性别 男 女   ";
                cin>>c;
                cout<<out<<" 请输入你的会员等级0 1 2 3   ";
                cin>>d;
                cout<<out<<"输入你的手机号:";
                cin>>e;
                int nnn=consumer::quantity;
                ll[nnn]. set_consumer(a,b,c,d,e);
                cout<<out<<"信息已存储"<<endl;
            }
            cout<<out<<"输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto x2;
        }
        else if(x==4)//返回
        {

            goto x;
        }
        else if(x==5)//退出
        {
            return 0;
        }
        else
        {
            cout<<out<<"输入错误,输入y继续操作,其他退出"<<endl;
            char  ss;
            cout<<out<<"请输入:";
            cin>>ss;
            if(ss=='y')
                goto  x2;
        }
    }
    else if(x==3)//退出
    {
        return 0;
    }
    else
    {
        cout<<out<<"输入错误,输入y继续操作,其他退出"<<endl;
        char  ss;
        cout<<out<<"请输入:";
        cin>>ss;
        if(ss=='y')
            goto  x;
    }
    ccout.close();//关闭文件
    ccin.close();//关闭文件
    oin.close();//关闭文件
    oout.close();//关闭文件
    return 0;
}
//************时间类函数*************
void date::set_date(int a,int b,int c)//日期类的修改函数
{
    year=a;
    month=b;
    day=c;
}
date::date(int a,int b,int c)//日期类的构造函数
{
    year=a;
    month=b;
    day=c;
}
date::date()//空的构造函数
{

}
void date::show_date()//打印日期
{
    cout<<year<<"."<<month<<"."<<day<<endl;
}
int date::get_year()//拿出year;
{
    return year;
}
int date::get_month()//拿出month
{
    return month;
}
int date::get_day()//拿出day
{
    return day;
}





//************人类函数*************
void people::set_people(string a,string b,string c)//修改人类
{
    name=a;
    number=b;
    sex=c;
}
people::people(string a,string b,string c)//人类的构造函数
{
    name=a;
    number=b;
    sex=c;
}
people::people()//人类的空构造函数
{

}
void people::show_people()//打印人类的数据
{
    cout<<out<<name<<"  "<<number<<"     "<<sex;
}
string people::get_name()//拿出名字
{
    return name;
}
string people::get_number()//拿出编号
{
    return number;
}
string people::get_sex()//拿出性别
{
    return sex;
}



//************消费类函数*************
void  consumer::set_consumer(string a,string b,string c,int d,string e)//修改顾客类,把空的修改为有信息的
{
    set_people( a, b, c);
    level=d;
    phonenumber=e;
    quantity++;
}
consumer::consumer(string a,string b,string c,int d,string e):people(a,b,c)//顾客类的构造函数
{
    level=d;
    phonenumber=e;
    quantity++;
}
consumer::consumer()//空构造函数
{
}
void consumer::show_consumer()//打印消费者类的信息
{
    show_people();
    cout<<level<<" "<<phonenumber<<endl;
}
string  consumer::get_name()//得到名字
{
    people::get_name();
}
string consumer::get_number()//得到编号
{
    people::get_number();
}
string consumer::get_sex()//得到性别
{
    people::get_sex();
}
int consumer::get_level()//得到会员等级
{
    return level;
}
string consumer::get_phonenumber()//得到手机号
{
    return phonenumber;
}


//************店员类函数*************
clerk::set_position(string a,string b,string c,string d)//修改店员
{
    ccout<<a<<"   "<<b<<"   "<<c<<"   "<<d<<endl;
    set_people( a, b, c);
    position=d;
}
clerk::clerk(string a,string b,string c,string d):people(a,b,c)//店员类的构造函数
{
    ccout<<a<<"   "<<b<<"   "<<c<<"   "<<d<<endl;
    quantity++;
    position=d;
}
clerk::clerk()//空构造函数
{
}
clerk::~ clerk()//析构函数
{
    quantity--;
}
void clerk::show_clerk()//打印职员信息
{
    people::show_people();
    cout<<"      "<<position<<endl;
}
string  clerk::get_name()//得到职员名字
{
    return name;
}
string  clerk::get_number()//得到职员编号
{
    people::get_number();
}
string  clerk::get_sex()//得到职员性别
{
    people::get_sex();
}
string  clerk::get_position()//得到职员职位
{
    return position;
}
void clerk::set_cherk(string a,string b,string c,string d)//修改职员,空的改成有的
{
    name=a;
    number=b;
    sex=c;
    position=d;
    quantity++;
}
//************车类函数*************

car::car(string a,int  b,int c)//构造函数
{
    name =a;
    price=b;
    number=c;
    quantity++;
}
void car::set_car(string a,int  b,int c)//把空的赋值,故种类加1
{
    name =a;
    price=b;
    number=c;
    quantity++;
}
car::car()//空构造函数
{
    name="空";
    price=0;
    number=0;
}
car::show_car()//打印车的信息
{
    cout<<out<<name<<"   "<<price<<"    "<<number<<endl;
}
void car::set_number(int a)//把车的数量拿出来修改
{
    number+=a;
}
string car::get_name()//把车名拿出来
{
    return name;
}
int& car::get_price()//修改车价格,引用可以直接修改
{
    return price;
}




//************订单类函数*************

order::order(string a,string b,string c,int d,int e,int f):D(d,e,f)//构造函数,嵌入时间类
{
    consumer_name=a;
    car_name=b;
    cherk_name=c;
    oout<<a<<"   "<<b<<"   "<<c<<"   "<<d<<"   "<<e<<"   "<<f<<endl;
    quantity++;
}
order::order()//空构造函数
{

}
void   order::show_order()//打印订单
{
    cout<<out<<consumer_name<<"  "<<car_name<<"   "<<cherk_name<<"   ";
    D.show_date();
}
void  order::set_order( string a,string b,string c,int d,int e,int f)
{
    consumer_name=a;
    car_name=b;
    cherk_name=c;
    D.set_date(d,e,f);
    oout<<a<<"   "<<b<<"   "<<c<<"   "<<d<<"   "<<e<<"   "<<f<<endl;
    quantity++;
}
string   order::get_car_name()//得到汽车名字
{
    return car_name;
}
string   order::get_consumer_name()//得到消费者名字
{
    return consumer_name;
}
string   order::get_cherk_name()//得到职员名字
{
    return cherk_name;
}
int  order::get_year()//年
{
    D.get_year();
}
int  order::get_month()//月
{
    D.get_month();
}
int  order::get_day()//日
{
    D.get_day();
}


//************维修类函数*************
repair::repair(string a,int b)//构造函数
{
    name=a;
    price=b;
    quantity++;
}
repair::repair()//空构造函数
{
}
void repair::set_repair(string a,int b)//修改维修
{
    name=a;
    price=b;
    quantity++;
}
string repair::get_name()//得到名字
{
    return name;
}
int  repair::get_price()//得到价格
{
    return price;
}
void  repair::show_repair()//打印维修信息
{
    cout<<out<<name<<"  "<<price<<endl;
}
/*void outcarprice()
{
    out<<"宝马"<<"       "<<60000<<endl;
    out<<"奇骏"<<"       "<<190000<<endl;
    out<<"MINI"<<"       "<<200000<<endl;
    out<<"威驰"<<"       "<<80000<<endl;
    out<<"瑞纳"<<"       "<<50000<<endl;
    out<<"宝骏"<<"       "<<40000<<endl;
    out<<"悦翔"<<"       "<<60000<<endl;
}
void outcrarprice()
{
    rout<<"一级维护"<<"       "<<60000<<endl;
    rout<<"二级维护"<<"       "<<190000<<endl;
    rout<<"三级维护"<<"       "<<200000<<endl;
    rout<<"汽车保养"<<"       "<<80000<<endl;
}*/
ostream &out(ostream &stream)
{
    cout<<"                        ";
}


  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
 《电脑4S店管理系统》是一款针对电脑行业开发的一款管理软件,该软件广泛适用于中小型电脑公司。系统主要包括基本信息、商品进货信息、商品销售信息、装机配置、售后服务、库存管理、财务管理、工资管理收入支出管理、初始化等功能。其中基础信息包括:(公司信息设置、员工信息登记、客户信息登记、供货商信息登记、仓库信息登记、商品信息登记、仓库商品登记);商品进货管理包括:(商品进货、商品退货、期间商品查询、期间退货查询);商品销售管理包括:(商品销售、商品退货、期间销售查询、期间退货查询);装机配置包括:(装机配置登记、装机配置单、期间配置收入统计);售后服务包括:( 接单登记、派工登记、维修登记、结算登记、回访登记、返修登记、维修费用统计);库存管理包括:(商品库存明细、商品结存数量、商品缺货提醒、商品调拨登记、商品调拨查看、库存盘点、确认审核、盘点初始化);财务管理包括:(进货付款、付款统计、销售收款、收款统计、固定资产(固定资产登记、固定资产查看、固定资产变动、资产折旧);工资管理包括:奖罚登记、奖罚统计、员工工资登记);收入支出管理包括:(支出管理、收入管理、期间支出查询、期间收入查询;初始化)。提供对任意时间段的进货、销售、退货情况查询和打印报表功能,并且可以随时查询和分析库存、应收、应付等信息,让您能及时并准确的了解任意时间段的经营状况。软件界面设计简洁、美观其人性化的管理可以使用户轻易上手,提升服务质量,提高工作效率。科学的管理方法会给您带来无限的效益,将是您明智的选择。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值