CCAT-S1试题-商品管理系统

/*
*程序的版权和版本声明部分:
*Copyright(c)2014,烟台大学计算机学院学生
*All rights reserved.
*文件名称:
*作者:田成琳
*完成日期:2014 年 5 月 18 日
*版本号:v1.0
*对任务及求解方法的描述部分:
*输入描述: -
*问题描述:商品信息管理系统
*程序输出:商品信息
*问题分析:
*算法设计:
*/
#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<string>
using namespace std;
void menu(); //菜单
void findMenu(); //查商品界面
void showProduct(int);//显示商品信息
int size=0; //记录当前商品数量
class Product
{
public:
    void addProduct(); //增加商品
    void findProductName(string); //名称查找商品
    void findProductNumber(string);//编号查找商品
    void findProductKind(string);//品牌查找商品
    void findProductKindNumber(string);//型号查找商品
    void display(); //显示所有商品信息
    string getName()
    {
        return name;
    }
    string getNumber()
    {
        return number;
    }
    string getKind()
    {
        return kind;
    }
    string getKindNumber()
    {
        return kindnumber;
    }
    double getPrice()
    {
        return price;
    }
private:
    string name,kind,number,kindnumber; //名称,品牌,编号,型号
    double price; //价格
};
Product b[20];

int main()
{
    int choose;
    do
    {
        menu();
        cin>>choose;
        if(choose==1)
            b[size].addProduct();
        else if(choose==2)
            findMenu();
        else if(choose==3)
            b[size].display();
        else if(choose==0)
            exit(0);
        else
            menu();
    }
    while(choose!=0);
    return 0;
}

void Product::addProduct()
{
    char yrn;
    cout<<"商品编号:";
    cin>>b[size].number;
    cout<<"商品名称:";
    cin>>b[size].name;
    cout<<"品牌:";
    cin>>b[size].kind;
    cout<<"型号:";
    cin>>b[size].kindnumber;
    cout<<"价格:";
    cin>>b[size].price;
    cout<<"增加成功!"<<endl;
    showProduct(size);
    size+=1;
    cout<<"是否继续添加?是(Y/y)否(N/n)";
    cin>>yrn;
    if(yrn=='y'||yrn=='Y')
        Product::addProduct();
}

void findProductNumber(string Bnumber)
{
    bool flag=false;
    int i;
    for(i=0; i<=size; ++i)
    {
        if(b[i].getNumber()==Bnumber)
        {
            flag=true;
            break;
        }
    }
    if(flag)
        showProduct(i);
    else
        cout<<"查无此商品!";
    findMenu();
}

void findProductName(string Bname)
{
    bool flag=false;
    int i;
    for(i=0; i<=size; ++i)
    {
        if(b[i].getName()==Bname)
        {
            flag=true;
            break;
        }
    }
    if(flag)
        showProduct(i);
    else
        cout<<"查无此商品!";
    findMenu();
}

void findProductKind(string Bkind)
{
    bool flag=false;
    int i;
    for(i=0; i<=size; ++i)
    {
        if(b[i].getKind()==Bkind)
        {
            flag=true;
            break;
        }
    }
    if(flag)
        showProduct(i);
    else
        cout<<"查无此商品!";
    findMenu();
}

void findProductKindnumber(string Bkindnumber)
{
    bool flag=false;
    int i;
    for(i=0; i<=size; ++i)
    {
        if(b[i].getKindNumber()==Bkindnumber)
        {
            flag=true;
            break;
        }
    }
    if(flag)
        showProduct(i);
    else
        cout<<"查无此商品!";
    findMenu();
}

void Product::display()
{
    for(int i=0; i<size; ++i)
        showProduct(i);
    findMenu();
}

void showProduct(int n)
{
    cout<<"-------------------------------------------------------"<<endl;
    cout<<"商品编号      商品名称      品牌        型号      价格"<<endl;
    cout<<b[n].getNumber()<<setw(20)<<b[n].getName();
    cout<<setw(8)<<b[n].getKind()<<setw(16)<<b[n].getKindNumber();
    cout<<setw(6)<<b[n].getPrice()<<endl;
    cout<<"-------------------------------------------------------"<<endl;
}

void findMenu()
{
    bool flag=true;
    int choose;
    string name,number,kindnumber,kind;
    while(flag)
    {
        cout<<"-----------------------"<<endl;
        cout<<"---  1  根据商品编号---"<<endl;
        cout<<"---  2  根据商品名称---"<<endl;
        cout<<"---  3  根据图书品牌---"<<endl;
        cout<<"---  4  根据商品型号-----"<<endl;
        cout<<"---  5  返回主菜单-----"<<endl;
        cin>>choose;
        switch(choose)
        {
        case 1:
            cout<<"请输入编号:";
            cin>>number;
            findProductNumber(number);
            break;
        case 2:
            cout<<"请输入名称:";
            cin>>name;
            findProductName(name);
            break;
        case 3:
            cout<<"请输入品牌:";
            cin>>kind;
            findProductKind(kind);
            break;
        case 4:
            cout<<"请输入型号:";
            cin>>kindnumber;
            findProductKind(kindnumber);
            break;
        case 5:
            flag=false;
            break;
        }
    }
}

void menu()
{
    cout<<"------------------------"<<endl;
    cout<<"----- 商品管理系统----- "<<endl;
    cout<<"------------------------"<<endl<<endl;
    cout<<"------------------------"<<endl;
    cout<<"----   1  增加商品  ----"<<endl;
    cout<<"----   2  查找商品  ----"<<endl;
    cout<<"----   3  显示全部  ----"<<endl;
    cout<<"----   0  退出系统  ----"<<endl;
    cout<<"请选择业务:";
}


运行结果:

心得体会:增、删、改、查,啊~~

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
图书管理信息系统 摘要 图书管理信息系统是典型的信息管理系统(MIS),其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点。 因此本人结合开入式图书馆的要求,对SQL Server2000数据库管理系统、SQL语言原理、NET应用程序设计进行了较深入的学习和应用,主要完成对图书管理信息系统的需求分析、功能模块划分、数据库需求分析,并由此设计了数据库结构和应用程序。系统运行结果证明,本文所设计的图书管理信息系统可以满足借阅者、图书馆工作人员的双方面的需要。 关键词:图书管理 系统设计 信息 Abstract Library management system is a typical management information system (MIS), its development mainly includes the background of the establishment and maintenance of database and application development front-end aspects of both. For the former requirement to establish data consistency and integrity, and data security database well. For applications which require full-featured and easy to use and so on. Therefore, I combined into the Library's request for SQL Server2000 database management system, SQL language principle, NET application design more in-depth study and application, mainly to complete the library management system needs analysis, functional modules, database needs analysis, and thus designed the database structure and applications. System is running the results proved that this article is designed to meet the lending library management system, the library staff of the required two-way street. Keywords: library management information system design 一、序言 为方便对图书馆书籍、读者资料、借还书等进行高效的管理,特编写该程序以提高图书馆的管理效率。使用该程序之后,工作人员可以查询某位读者、某种图书的借阅情况,还可以对当前图书借阅情况进行一些统计,给出统计表格,以便全面掌握图书的流通情况。既然图书管理是一个为大众提供信息的平台,所以本组要开发的图书管理信息系统是用来实现对图书文档的管理。 二、需求分析说明书 2.1系统介绍 本系统定位于中小型书店、个体书店,暂时考虑单机环境下的实现;操作系统选择目前常用的Windows 98/2000。系统性质为MIS(管理信息系统)或财务软件。 本系统采用会员制管理,系统功能应包含进书管理、售书管理、退货管理、库存管理、统计分析、相关人员管理等。系统界面力求简洁、易用,在标准化的基础上考虑界面的美观和新颖。 系统计划2008年12月初开始,次月初完成初步开发工作,其余工作根据时间安排进行。 2.2系统面向的用户群体 系统面向中小型书店、个体书店,用户群体为这些书店的经理、采购员/仓库管理员、图书销售人员、书店的会员/游客等。 2.3系统的功能性需求 功能序号 功能名称 功能说明 1 供应商管理 包含供应商信息的登记、修改等 2 图书种类管理 包含图书大类、小类的创建 3 图书资料管理 包含图书资料的添加、修改等 4 新书入库管理 登记新书的来源、数量、单价、折扣、金额等 5 库存统计 分门别类统计图书现有库存量、入库时间等 6 进货记录查询 查询历次进货记录 7 退货登记 登记供应商、图书种类、退货的数量、原因等 8 退货统计 按供应商统计退货记录 9 退货记录查询 查询历次退货记

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值