汽车销售管理系统源代码

经过数据结构实训,我第一次一个人写出了1000多行的代码,对自己也是一个挑战吧

#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
using namespace std;

//定义一个主菜单操作员显示类,供操作员登陆管理
class MainMenu
{
public:
    void ShowMain();
} MainMenu1;
void MainMenu::ShowMain()
{
    cout<<"\t┏═══════════════════════════┓"<>Name;
    cout<<"\t\t请正确输入操作员的密码:"<>Mima;
}
void Operator::Cout()
{
    if(Name=="admin" && Mima=="123456")
    {
        cout<<"\t登陆成功!"<>n;
    for(int i=0; i>move1->UserName;
        //给节点赋值
        cout<<"请输入第"<>move1->UserSex;
        //给节点赋值
        cout<<"请输入第"<>move1->UserAge;
        //给节点赋值
        cout<<"请输入第"<>move1->UserNumber;
        //给节点赋值
        cout<<"请输入第"<>move1->UserAddress;
        //给节点赋值
        cout<<"请输入第"<>move1->UserLink;
        //--------
        //这里就是链表连接的关键代码
        //先移动temp1指针
        temp1=move1;
        User *move1=new User;
        temp1->next=move1;
    }
    //这里注意链表规定 最后节点的next一定要指向NULL
    temp1=move1;
    temp1->next=NULL;
    //个人习惯
    move1=head1;
}
void User::UserDel(User *head1,User *move1,User *temp1)
{
    cout<<"请输入要删除的客户号:"<>Number;
    if(head1->UserNumber==Number)
    {
        head1=head1->next;
        free(head1);
        cout<<"成功删除用户!"<next!=NULL)
        {
            if(move1->UserNumber==Number)
            {
                temp1->next=move1->next;
                free(move1);
                cout<<"成功删除用户!"<next;
        }
    }
    move1=head1;
}
void User::UserChange(User *head1,User *move1,User *temp1)
{
    cout<<"请输入要修改的用户的客户号:"<>Number;
    while(move1->next!=NULL)
    {
        if(move1->UserNumber==Number)
        {
            //给节点重新赋值
            cout<<"请输入用户的客户号:"<>move1->UserNumber;
            //给节点重新赋值
            cout<<"请输入用户的姓名:"<>move1->UserName;
            //给节点重新赋值
            cout<<"请输入用户的性别:"<>move1->UserSex;
            //给节点重新赋值
            cout<<"请输入用户的年龄:"<>move1->UserAge;
            //给节点重新赋值
            cout<<"请输入用户的地址:"<>move1->UserAddress;
            //给节点重新赋值
            cout<<"请输入用户的联系方式:"<>move1->UserLink;
        }
        move1=move1->next;
    }
    move1=head1;
}
void User::UserFind(User *head1,User *move1,User *temp1)
{
    cout<<"请输入要查找的用户的客户号:"<>Number;
    while(move1->next!=NULL)
    {
        if(move1->UserNumber==Number)
        {
            cout<<"成功查找到用户!"<next;
    }
    move1=head1;
}
void User::UserInsert(User *head1,User *move1,User *temp1)
{
    cout<<"请输入要在哪个用户的客户号后面插入:"<>Number;
    while(move1->next!=NULL)
    {
        if(move1->UserNumber==Number)
        {
            User *temp1 = new User;
            cout<<"请输入用户的客户号:"<>move1->UserNumber;
            //给节点赋值
            cout<<"请输入用户的姓名:"<>move1->UserName;
            //给节点赋值
            cout<<"请输入用户的性别:"<>move1->UserSex;
            //给节点重新赋值
            cout<<"请输入用户的年龄:"<>move1->UserAge;
            //给节点重新赋值
            cout<<"请输入用户的地址:"<>move1->UserAddress;
            //给节点重新赋值
            cout<<"请输入用户的联系方式:"<>move1->UserLink;
            //----
            temp1->next=move1->next;
            move1->next=temp1;
        }
        move1=move1->next;
    }
    temp1=move1;
    temp1->next=NULL;
    move1=head1;
}
class UserInfor
{
public:
    void ShowInfor();
} UserInfor1;
void UserInfor::ShowInfor()
{
    cout<<"\t┠═══════════════════════════┨"<>n;
    for(int i=0; i>move2->Purchase_Number;
        //给节点赋值
        cout<<"请输入第"<>move2->Purchase_Date;
        //给节点赋值
        cout<<"请输入第"<>move2->Firm_Num;
        //给节点赋值
        cout<<"请输入第"<>move2->Firm_Name;
        //给节点赋值
        cout<<"请输入第"<>move2->Link_Man;
        //给节点赋值
        cout<<"请输入第"<>move2->Link_Num;
        //给节点赋值
        cout<<"请输入第"<>move2->Zip_Code;
        //给节点赋值
        cout<<"请输入第"<>move2->Mail_Address;
        //给节点赋值
        cout<<"请输入第"<>move2->Car_Code;
        //给节点赋值
        cout<<"请输入第"<>move2->Car_Type;
        //给节点赋值
        cout<<"请输入第"<>move2->Brand_Type;
        //给节点赋值
        cout<<"请输入第"<>move2->Produce_Area;
        //给节点赋值
        cout<<"请输入第"<>move2->Purchase_price;
        //给节点赋值
        cout<<"请输入第"<>move2->Sale_Man;
        //给节点赋值
        cout<<"请输入第"<>move2->Produce_Man;
        //--------
        //这里就是链表连接的关键代码
        //先移动temp1指针
        temp2=move2;
        CarPurchase *move2=new CarPurchase;
        temp2->next=move2;
    }
    //这里注意链表规定 最后节点的next一定要指向NULL
    temp2=move2;
    temp2->next=NULL;
    //个人习惯
    move2=head2;
}
void CarPurchase::CarPurchaseDel(CarPurchase *head2,CarPurchase *move2,CarPurchase *temp2)
{
    cout<<"请输入要删除的车辆的采购订单号:"<>Number;
    if(head2->Purchase_Number==Number)
    {
        head2=head2->next;
        free(head2);
        cout<<"成功删除该车辆采购的所有相关信息!"<next!=NULL)
        {
            if(move2->Purchase_Number==Number)
            {
                temp2->next=move2->next;
                free(move2);
                cout<<"成功删除该车辆采购的所有相关信息!"<next;
        }
    }
    move2=head2;
}
void CarPurchase::CarPurchaseChange(CarPurchase *head2,CarPurchase *move2,CarPurchase *temp2)
{
    cout<<"请输入要修改的厂商编号:"<>Number;
    while(move2->next!=NULL)
    {
        if(move2->Purchase_Number==Number)
        {
            //给节点赋值
            cout<<"请输入汽车的采购订单号:"<>move2->Purchase_Number;
            //给节点赋值
            cout<<"请输入汽车的采购日期:"<>move2->Purchase_Date;
            //给节点赋值
            cout<<"请输入汽车的厂商编号:"<>move2->Firm_Num;
            //给节点赋值
            cout<<"请输入汽车的厂商名称:"<>move2->Firm_Name;
            //给节点赋值
            cout<<"请输入汽车的联系人:"<>move2->Link_Man;
            //给节点赋值
            cout<<"请输入汽车的联系电话:"<>move2->Link_Num;
            //给节点赋值
            cout<<"请输入汽车的邮政编码:"<>move2->Zip_Code;
            //给节点赋值
            cout<<"请输入汽车的通信地址:"<>move2->Mail_Address;
            //给节点赋值
            cout<<"请输入汽车的车型代码:"<>move2->Car_Code;
            //给节点赋值
            cout<<"请输入汽车的车辆类型:"<>move2->Car_Type;
            //给节点赋值
            cout<<"请输入汽车的厂牌型号:"<>move2->Brand_Type;
            //给节点赋值
            cout<<"请输入汽车的产地:"<>move2->Produce_Area;
            //给节点赋值
            cout<<"请输入汽车的采购单价:"<>move2->Purchase_price;
            //给节点赋值
            cout<<"请输入汽车的业务员:"<>move2->Sale_Man;
            //给节点赋值
            cout<<"请输入汽车的制单员:"<>move2->Produce_Man;
        }
        move2=move2->next;
    }
    move2=head2;
}
void CarPurchase::CarPurchaseFind(CarPurchase *head2,CarPurchase *move2,CarPurchase *temp2)
{
    cout<<"请输入要查找的车辆的采购订单号:"<>Number;
    while(move2->next!=NULL)
    {
        if(move2->Purchase_Number==Number)
        {
            cout<<"成功查找到车辆的采购信息!"<next;
    }
    move2=head2;
}
void CarPurchase::CarPurchaseInsert(CarPurchase *head2,CarPurchase *move2,CarPurchase *temp2)
{

    cout<<"请输入要在哪个车辆的采购订单号后面插入:"<>Number;
    while(move2->next!=NULL)
    {
        if(move2->Purchase_Number==Number)
        {
            CarPurchase *temp2 = new CarPurchase;
            //给节点赋值
            cout<<"请输入汽车的采购订单号:"<>move2->Purchase_Number;
            //给节点赋值
            cout<<"请输入汽车的采购日期:"<>move2->Purchase_Date;
            //给节点赋值
            cout<<"请输入汽车的厂商编号:"<>move2->Firm_Num;
            //给节点赋值
            cout<<"请输入汽车的厂商名称:"<>move2->Firm_Name;
            //给节点赋值
            cout<<"请输入汽车的联系人:"<>move2->Link_Man;
            //给节点赋值
            cout<<"请输入汽车的联系电话:"<>move2->Link_Num;
            //给节点赋值
            cout<<"请输入汽车的邮政编码:"<>move2->Zip_Code;
            //给节点赋值
            cout<<"请输入汽车的通信地址:"<>move2->Mail_Address;
            //给节点赋值
            cout<<"请输入汽车的车型代码:"<>move2->Car_Code;
            //给节点赋值
            cout<<"请输入汽车的车辆类型:"<>move2->Car_Type;
            //给节点赋值
            cout<<"请输入汽车的厂牌型号:"<>move2->Brand_Type;
            //给节点赋值
            cout<<"请输入汽车的产地:"<>move2->Produce_Area;
            //给节点赋值
            cout<<"请输入汽车的采购单价:"<>move2->Purchase_price;
            //给节点赋值
            cout<<"请输入汽车的业务员:"<>move2->Sale_Man;
            //给节点赋值
            cout<<"请输入汽车的制单员:"<>move2->Produce_Man;
            //----
            temp2->next=move2->next;
            move2->next=temp2;
        }
        move2=move2->next;
    }
    temp2=move2;
    temp2->next=NULL;
    move2=head2;
}

class CarPurchaseInfor
{
public:
    void CarPurchaseInforMain();
} CarPurchaseInfor1;
void CarPurchaseInfor::CarPurchaseInforMain()
{
    cout<<"\t┠═══════════════════════════┨"<>n;
    for(int i=0; i>move3->Sell_Num;
        //给节点赋值
        cout<<"请输入第"<>move3->Client_Num;
        //给节点赋值
        cout<<"请输入第"<>move3->Client_Name;
        //给节点赋值
        cout<<"请输入第"<>move3->Car_Code;
        //给节点赋值
        cout<<"请输入第"<>move3->Car_Type;
        //给节点赋值
        cout<<"请输入第"<>move3->Produce_Type;
        //给节点赋值
        cout<<"请输入第"<>move3->Produce_Area;
        //--------
        //这里就是链表连接的关键代码
        //先移动temp1指针
        temp3=move3;
        CarSell *move3=new CarSell;
        temp3->next=move3;
    }
    //这里注意链表规定 最后节点的next一定要指向NULL
    temp3=move3;
    temp3->next=NULL;
    //个人习惯
    move3=head3;
}
void CarSell::CarSellDel(CarSell *head3,CarSell *move3,CarSell *temp3)
{
    cout<<"请输入要删除的车辆的销售单号:"<>Number;
    if(head3->Sell_Num==Number)
    {
        head3=head3->next;
        free(head3);
        cout<<"成功删除该车辆销售的所有相关信息!"<next!=NULL)
        {
            if(move3->Sell_Num==Number)
            {
                temp3->next=move3->next;
                free(move3);
                cout<<"成功删除该车辆销售的所有相关信息!"<next;
        }
    }
    move3=head3;
}
void CarSell::CarSellChange(CarSell *head3,CarSell *move3,CarSell *temp3)
{
    cout<<"请输入要修改的销售单号:"<>Number;
    while(move3->next!=NULL)
    {
        if(move3->Sell_Num==Number)
        {
            //给节点赋值
            cout<<"请输入汽车的销售单号:"<>move3->Sell_Num;
            //给节点赋值
            cout<<"请输入汽车的客户编号:"<>move3->Client_Num;
            //给节点赋值
            cout<<"请输入汽车的客户名称:"<>move3->Client_Name;
            //给节点赋值
            cout<<"请输入汽车的车型代码:"<>move3->Car_Code;
            //给节点赋值
            cout<<"请输入汽车的车辆类型:"<>move3->Car_Type;
            //给节点赋值
            cout<<"请输入汽车的厂牌型号:"<>move3->Produce_Type;
            //给节点赋值
            cout<<"请输入汽车的产地:"<>move3->Produce_Area;
            //--------
        }
        move3=move3->next;
    }
    move3=head3;
}
void CarSell::CarSellFind(CarSell *head3,CarSell *move3,CarSell *temp3)
{
    cout<<"请输入要查找的车辆的销售单号:"<>Number;
    while(move3->next!=NULL)
    {
        if(move3->Sell_Num==Number)
        {
            cout<<"成功查找到车辆的销售信息!"<next;
    }
    move3=head3;
}
void CarSell::CarSellInsert(CarSell *head3,CarSell *move3,CarSell *temp3)
{

    cout<<"请输入要在哪个车辆的销售单号后面插入:"<>Number;
    while(move3->next!=NULL)
    {
        if(move3->Sell_Num==Number)
        {
            CarSell *temp3 = new CarSell;
            //给节点赋值
            cout<<"请输入汽车的销售单号:"<>move3->Sell_Num;
            //给节点赋值
            cout<<"请输入汽车的客户编号:"<>move3->Client_Num;
            //给节点赋值
            cout<<"请输入汽车的客户名称:"<>move3->Client_Name;
            //给节点赋值
            cout<<"请输入汽车的车型代码:"<>move3->Car_Code;
            //给节点赋值
            cout<<"请输入汽车的车辆类型:"<>move3->Car_Type;
            //给节点赋值
            cout<<"请输入汽车的厂牌型号:"<>move3->Produce_Type;
            //给节点赋值
            cout<<"请输入汽车的产地:"<>move3->Produce_Area;
            //--------
            temp3->next=move3->next;
            move3->next=temp3;
        }
        move3=move3->next;
    }
    temp3=move3;
    temp3->next=NULL;
    move3=head3;
}
class CarSellInfor
{
public:
    void CarSellInforMain();
} CarSellInfor1;
void CarSellInfor::CarSellInforMain()
{
    cout<<"\t┠═══════════════════════════┨"<=x) j--;// 从右向左找第一个小于x的数
        InStore_N[i]=InStore_N[j];
        while(i=r) return;
    int x=paixu(l,r);
    Qsort(l,x-1);
    Qsort(x+1,r);
}
void CarStore::Infor()
{
    cout<<"请输入入库单号的数量:"<>n;
    for(int i=0; i>InStore_N[i];
    }
    Qsort(0,n-1);
    for(int i=0; i>n;
    flag=-1;//特殊标记
    low=1;
    high=n;
    for(int i=1; i<=n; i++)
    {
        cout<<"请依次输入n个递增的入库单号的序列:"<>InStore_N[i];
    }
    cout<<"请输入你要查询的入库单号:"<>key;
    while(low<=high)
    {
        mid=(low+high)/2;
        if(key==InStore_N[mid])
        {
            flag=mid;
            break;
        }
        else if(keyInStore_N[mid])
        {
            low=mid+1;
        }
    }
    if(flag!=-1)
    {
        cout<<"存在要查找的入库单号的信息,查找成功!"<q;
    int T;
    string str;
    cout<<"请输入入库单的数量:"<>T;
    for(int i=0; i q;
        for(int i=0; i>str;          //操作判断
            if(str=="push")
            {
                int n;
                cout<<"请输入你要添加的入库单号:"<>n;
                q.push(n);//进栈
                continue;
            }
            else if(str=="top")
            {
                if(q.empty())
                {
                    cout<<"empty"<>choose;
        if(choose)
        {
            if(choose==1)
            {
                Operator1.Cin();
                Operator1.Cout();
                Sleep(1000);
                system("cls");
                OperatorMain1.OperatorShow();
                cout<<"请选择管理的对象:"<>choose0;
                if(choose0==1)
                {
                    system("cls");
                    UserInfor1.ShowInfor();
                    User *head1,*move1,*temp1;
                    head1=move1=(User *)malloc(sizeof(User));
                    int choose1=0;
                    cout<<"请选择对用户信息的操作"<>choose1;
                    if(choose1==1)
                    {
                        User1.UserAdd(head1,move1,temp1);
                        Sleep(1000);
                    }
                    else if(choose1==2)
                    {
                        User1.UserDel(head1,move1,temp1);
                        Sleep(1000);
                    }
                    else if(choose1==3)
                    {
                        User1.UserChange(head1,move1,temp1);
                        Sleep(1000);
                    }
                    else if(choose1==4)
                    {
                        User1.UserFind(head1,move1,temp1);
                        Sleep(1000);
                    }
                    else if(choose1==5)
                    {
                        User1.UserInsert(head1,move1,temp1);
                        Sleep(1000);
                    }
                }
                if(choose0==2)
                {
                    system("cls");
                    CarPurchaseInfor1.CarPurchaseInforMain();
                    CarPurchase *head2,*move2,*temp2;
                    head2=move2=(CarPurchase *)malloc(sizeof(CarPurchase));
                    int choose2=0;
                    cout<<"请选择对车辆采购信息的操作"<>choose2;
                    if(choose2==1)
                    {
                        CarPurchase1.CarPurchaseAdd(head2,move2,temp2);
                        Sleep(1000);
                    }
                    else if(choose2==2)
                    {
                        CarPurchase1.CarPurchaseDel(head2,move2,temp2);
                        Sleep(1000);
                    }
                    else if(choose2==3)
                    {
                        CarPurchase1.CarPurchaseChange(head2,move2,temp2);
                        Sleep(1000);
                    }
                    else if(choose2==4)
                    {
                        CarPurchase1.CarPurchaseFind(head2,move2,temp2);
                        Sleep(1000);
                    }
                    else if(choose2==5)
                    {
                        CarPurchase1.CarPurchaseInsert(head2,move2,temp2);
                        Sleep(1000);
                    }
                }
                if(choose0==3)
                {
                    system("cls");
                    CarSellInfor1.CarSellInforMain();
                    CarSell *head3,*move3,*temp3;
                    head3=move3=(CarSell *)malloc(sizeof(CarSell));
                    int choose3=0;
                    cout<<"请选择对车辆销售信息的操作"<>choose3;
                    if(choose3==1)
                    {
                        CarSell1.CarSellAdd(head3,move3,temp3);
                        Sleep(1000);
                    }
                    else if(choose3==2)
                    {
                        CarSell1.CarSellDel(head3,move3,temp3);
                        Sleep(1000);
                    }
                    else if(choose3==3)
                    {
                        CarSell1.CarSellChange(head3,move3,temp3);
                        Sleep(1000);
                    }
                    else if(choose3==4)
                    {
                        CarSell1.CarSellFind(head3,move3,temp3);
                        Sleep(1000);
                    }
                    else if(choose3==5)
                    {
                        CarSell1.CarSellInsert(head3,move3,temp3);
                        Sleep(1000);
                    }
                }
                if(choose0==4)
                {
                    system("cls");
                    CarStoreInfor1.CarStoreInforMain();
                    int choose4=0;
                    cout<<"请选择你对入库信息的操作:"<>choose4;
                    if(choose4==1)
                    {
                        CarStore1.Infor();
                        Sleep(1000);
                    }
                    if(choose4==2)
                    {
                        CarStore1.BarInserch();
                        Sleep(1000);
                    }
                    if(choose4==3)
                    {
                        CarStore1.LatterDo();
                        Sleep(1000);
                    }
                }
                if(choose0==0)
                {
                    system("cls");
                    break;
                }
            }
        }
    }
    return 0;
}


你可能感兴趣的:(软件实践开发,数据结构)