书店管理系统(C++初学者友好版)

经验记录-数量分摊和均分 环境:Oracle数据库,PL/SQL 一、问题描述 1、测试数据:   存在表CJ_T_PHONE,存储一批用户号码;   存在表CJ_T_GROUP,存储一批渠道、渠道管理号码数。   数据如下图: 2、实现需求:   将这批号码分配给这批渠道,每个渠道分配的号码数在渠道表已提供。号码对应哪个渠道,无要求,可随机。 二、解决思路: 对PHONE表根据号码排序,排序方式无所谓,主要是为了取号码的序号。这里使用的是ROW_NUMBER() OVER(ORDER BY XX)实现,需确保号码无重复(如 阅读详情

写在前面

正如标题所示,本文是写给C++的初学者的一个书店管理系统实例。为了贴近目标读者的需求,本篇博客中的代码仅采用了初级的内容。比如:对于书的名字,采取了最简单粗暴的多维字符串存储而不是Trie树甚或AC自动机;对于所有排序操作,均采用简单粗暴的冒泡排序,而不是重载运算符后调用STL中的sort函数。力求简单易懂,为C++初学者提供良好的阅读体验。

此外,与我惯于对付的传统竞赛题不同的是,此类题目需要更多考虑到使用者的层次和需求。需要提供一定的使用指导和人机交互界面,还需要考虑到一些不合法的输入。因为本篇博客中的代码仅作抛砖引玉之用(以及本人的懒惰),代码中仅加入了有限的不合法输入判定,仍然存在非常多的不合法输入可以导致程序不能正常运行。同时,如果仅仅满足下方图片所示的要求,作为一个书店管理系统还是有所欠缺,可以加入诸如图形界面、撤销操作、修改操作等更多功能。

学海无涯,本人也不过先行几步。以上所述,就权作对后续学习的一点浅见。

题目要求

题目要求
(鉴于图片足够清晰,就不手打了)

主体思路

对于图书信息的储存,显然单独开若干个数组将书名、作者、出版社等信息分别储存并不是一种优美的做法(当然,从这句话可以看出这种解决方案依旧可行)。所以,我们应该将这些信息“绑定”在一起,相当于一种新的数据类型 b o o k book book。这种方法叫做定义结构体,将在下一个章节讲到。

当我们想要查找某一本书的时候,直接用for循环遍历已有的所有书并进行for循环暴力字符串匹配即可。

对于一本书的销售额、销售数量,同样可以定义两个变量一起“绑定”在 b o o k book book里,在排序时直接按照给定的关键字来排序。

至于进出货记录,可以直接开多维数组记录 进/出货、数量、交易额等信息,也可以定义结构体。

代码实现

定义结构体book

这一步很简单,掌握了相应的语法之后,只需要把你想要“绑定”在一起的各个变量、数组加进去即可。语法如下:

struct 定义的新数据类型名字
{
	变量1、变量2、……
	数组1、数组2、……
};

在本题中,按照题目要求,我们定义如下结构体:

struct book
{
    int number,publishDate[5],salesVolume;
    char name[50],publisher[50],author[50];
    double price,sales;
    bool discount;
}books[M];

注:右花括号与分号之间的books[M]是声明数组一个 b o o k book book类型的数组book books[M];的简化写法。

读入带空格字符串的函数

显然,书名、作者、出版社等信息都是带空格的字符串,不能简单地用scanf("%s",str)来代替。因此,我们需要单独编写对应函数。

在下方所示的函数中,传入参数时,传入了字符串数组的地址,这样就可以直接修改对应字符串数组。

第一个for循环筛除了字符串开头所有非数字且非字母的字符,其中isdigit()判断一个字符是否为数字,isalpha()判断一个字符是否为字母。

第二个for循环开始读入,直到读到换行符时停止读入。其中,(为了省事)第0个位置str[0]被我用来记录字符串的长度,str[1]~str[str[0]]为字符串内容。

void readString(char *str)
{
    char c=getchar();
    for(;!isdigit(c)&&!isalpha(c);c=getchar());
    for(str[0]=0;c!='\n';c=getchar())str[++str[0]]=c;
}

通过书名查找书的编号

这个就很暴力了,for循环即可。

值得注意的是,我们这里传入的数组是形参形式,函数内对数组的更改并不会影响原本的数组。

int enquireByName(char goal[])
{
    for(int i=1;i<=totalNumber;++i)
    {
        int flag=1;
        for(int j=1;j<=books[i].name[0];++j)
        if(books[i].name[j]!=goal[j]){flag=0;break;}
        if(flag)return i;
    }
    return 0;
}

进货函数

有了之前写的若干函数,就很简单了,先输入要进货的书的书名,在已有书中检索,如果书已存在,直接对数目进行修改;如果之前没有过这本书,就用读入带空格字符串函数读入各种信息储存到books数组里,并为新入库的书编号。在函数结尾,将进货记录保存到records数组里。

void purchase()
{
    int id=0,tmp=0;
    puts("-Please input the title of the book you want to stock (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    if(id=enquireByName(tmpBook))
    {
        puts("-The information of this book has already been recorded in system");
        puts("-So you only need to input the number of newly purchased books");
        scanf("%d",&tmp),books[id].number+=tmp;
    }
    else
    {
        id=++totalNumber;
        for(int i=0;i<=tmpBook[0];++i)books[id].name[i]=tmpBook[i];
        puts("-This is a book that we never purchased before");
        puts("-Please input its detailed information");
        puts("-Please input the author of the book you want to stock (Press \"Enter\" to complete your input)");
        readString(books[totalNumber].author);
        puts("-Please input the publishing house of the book you want to stock (Press \"Enter\" to complete your input)");
        readString(books[totalNumber].publisher);
        puts("-Please input the price of the book you want to stock (Press \"Enter\" to complete your input)");
        scanf("%lf",&books[totalNumber].price);
        puts("-Is there a discount for this book (Input 0 for No or 1 for Yes)");
        scanf("%d",&books[totalNumber].discount);
        puts("-Please input the number of newly purchased books (Press \"Enter\" to complete your input)");
        scanf("%d",&books[totalNumber].number),tmp=books[totalNumber].number;
        puts("-Please input the publishing date of the book you want to stock (Press \"Enter\" to complete your input)");
        puts("-Please input as follow format: Year Month Day (3 numbers divided by space)");
        for(int i=1;i<=3;++i)
        scanf("%d",&books[totalNumber].publishDate[i]);
    }
    records[++cot][0]=0,records[cot][1]=id,records[cot][2]=tmp;
    puts("-Opration ends");
}

出货函数

出货函数和进货函数逻辑类似,都是在库存中查找,检查是否有足够的库存,再检查有无折扣,最后生成一条新的出货记录。

void sell()
{
    puts("-Please input the title of the book you want to sell (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    int id=enquireByName(tmpBook),tmp,lev=0;
    if(!id){puts("-There is no book called this!");return;}
    if(books[id].discount)
    {
        puts("-This book can be discounted.");
        puts("-Please input the buyer's VIP level (Press \"Enter\" to complete your input)");
        scanf("%d",&lev);
        if(lev<0||lev>3){puts("-Invalid level!");return;}
    }
    else puts("-This book can't be discounted.");
    puts("-Please input the number of the book you want to sell (Press \"Enter\" to complete your input)");
    scanf("%d",&tmp);
    if(tmp>books[id].number){puts("-No enough books here");return;}
    books[id].number-=tmp;
    books[id].salesVolume+=tmp;
    books[id].sales+=tmp*VIP[lev]*books[id].price;
    records[++cot][0]=1,records[cot][1]=id,records[cot][2]=tmp,salesRecords[cot]=tmp*VIP[lev]*books[id].price;
    puts("-Opration ends");
}

查询某书的详细信息、销售情况、库存函数

这三个函数比较雷同,都是先通过书名查找,然后直接将结构体内记录的内容输出即可。如果是通过编号查找,则直接输出即可。

查询详细信息函数

void enquireBy(int p)//0-name 1-id
{
    int id;
    if(p)
    {
        puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
        scanf("%d",&id);
        if(id<=0||id>totalNumber){puts("-There is no book numbered this!");return;}
        printBook(id);
        return;
    }
    puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    id=enquireByName(tmpBook);
    if(!id){puts("-There is no book called this!");return;}
    printBook(id);
    puts("-Opration ends");
}

查询销售情况函数

void enquireSalesBy(int p)//0-name 1-id
{
    int id;
    if(p)
    {
        puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
        scanf("%d",&id);
        if(id<=0||id>totalNumber){puts("-There is no book numbered this!");return;}
        printf("-Sell %d books for $%.2lf.\n",books[id].salesVolume,books[id].sales);
        return;
    }
    puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    id=enquireByName(tmpBook);
    if(!id){puts("-There is no book called this!");return;}
    printf("-Sell %d books for $%.2lf.\n",books[id].salesVolume,books[id].sales);
    puts("-Opration ends");
}

查询库存函数

void enquireInventoryBy(int p)//0-name 1-id
{
    int id;
    if(p)
    {
        puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
        scanf("%d",&id);
        if(id<=0||id>totalNumber){puts("-There is no book numbered this!");return;}
        printf("-The number of this book in inventory is %d.\n",books[id].number);
        return;
    }
    puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    id=enquireByName(tmpBook);
    if(!id){puts("-There is no book called this!");return;}
    printf("-The number of this book in inventory is %d.\n",books[id].number);
    puts("-Opration ends");
}

查询进/出货记录函数

根据查找的类型,把records数组里的信息输出即可,这里出货额度我单独开了一个double类型的salesRecords数组。

void enquireRecords(int p)//0-purchase 1-sell
{
    if(p)puts("-Sell records:");
    else puts("-Purchase records:");
    for(int i=1;i<=cot;++i)
    if(records[i][0]==p)
    {
        if(p)printf("-Sell");
        else printf("-Purchase");
        printf(" %d ",records[i][2]);
        printString(books[records[i][1]].name);
        if(p)printf("for $%.2lf\n\n",salesRecords[i]);
    }
    puts("-Opration ends");
}

排序函数

因为这里有两种关键字排序方式,且book类型中有很多与排序操作无关的其他信息,最重要的是我直接把数组下标作为书的编号,所以books数组里的数据位置不能随意变动。

分析一下,实际上与排序有关的变量只有两个:排序所用关键字以及关键字对应的书的编号。只要有这两个信息,我们就可以实现排序功能。

因此,我们开一个临时二位数组tool来储存这两个信息,再使用冒泡排序以给定的关键字排序。

具体实现是,先把编号和所需关键字复制到tool数组中:

for(int i=1;i<=totalNumber;++i)
{
    tool[i][0]=i;
    tool[i][1]=p?books[i].sales:books[i].salesVolume;
}

这里第二行使用了三目运算,相当于一个if+else:

if(p)tool[i][1]=books[i].sales;
else tool[i][1]=books[i].salesVolume;

之后就是双重for循环实现的冒泡排序,注意在交换元素的时候,要将tool[i][0]和tool[i][1]中的数据一起交换。

for(int i=1;i<=totalNumber;++i)for(int j=i+1;j<=totalNumber;++j)
    if(tool[i][1]<tool[j][1])swap(tool[i][1],tool[j][1]),swap(tool[i][0],tool[j][0]);

这样我们把tool数组按照tool[i][1]排好了序,tool[i][0]里就是对应的书的编号,按照该顺序输出编号对应书名即可。

for(int i=1;i<=totalNumber;++i)
    printString(books[(int)tool[i][0]].name);

注:因为销售额为小数类型,所以二位数组不能开int类型,但是double类型又不能作为数组下标,所以在代入books数组是要用(int)tool[i][0]转换数据类型(不偷懒的做法是定义一个结构体)。

完整代码:

double tool[M][2];
void sortAs(int p)//0-salesVolume 1-sales
{
    for(int i=1;i<=totalNumber;++i)
    {
        tool[i][0]=i;
        tool[i][1]=p?books[i].sales:books[i].salesVolume;
    }
    for(int i=1;i<=totalNumber;++i)for(int j=i+1;j<=totalNumber;++j)
    if(tool[i][1]<tool[j][1])swap(tool[i][1],tool[j][1]),swap(tool[i][0],tool[j][0]);
    for(int i=1;i<=totalNumber;++i)
    printString(books[(int)tool[i][0]].name);
    puts("-Opration ends");
}

其他函数

这些函数都比较浅显,不多做说明。

输出带空格字符串函数

这个函数是建立在读入函数的规则之上的。

void printString(char str[])
{
    for(int i=1;i<=str[0];++i)printf("%c",str[i]);
    putchar(10);
}

输出一本书的详细信息函数

void printBook(int id)
{
    puts("-The title of the book is:");
    printString(books[id].name);
    puts("-The author of the book is:");
    printString(books[id].author);
    puts("-The publishing house of the book is");
    printString(books[id].publisher);
    puts("-The price of the book is:");
    printf("$%.2lf\n",books[id].price);
    if(books[id].discount)puts("-There is a discount for this book");
    else puts("-There isn't a discount for this book");
    puts("-The publishing date of the book is:");
    for(int i=1;i<=3;++i)printf("%d ",books[id].publishDate[i]);putchar(10);
}

输出操作列表函数

void operationList()
{
    puts("-Operate by inputting the corresponding number as follow:");
    puts(" 1 Enquire a book's detailed information through its name.");
    puts(" 2 Enquire a book's sales.");
    puts(" 3 Enquire a book's inventory.");
    puts(" 4 Sort by sales.");
    puts(" 5 Sort by sales Volume.");
    puts(" 6 Enquire the records of stocking.");
    puts(" 7 Enquire the records of exporting.");
    puts(" 8 Purchase one kind of book.");
    puts(" 9 Sell one kind of book.");
    puts(" 0 Operation list.");
    puts("-Input a digit less than 0 to exit the system." );
}

完整代码

W e l c o m e   t o   u s e   P i B o o k   b o o k   m a n a g e m e n t   s y s t e m ! Welcome\ to\ use\ PiBook\ book\ management\ system! Welcome to use PiBook book management system!

#include<bits/stdc++.h>
using namespace std;
const int M=1005;
int totalNumber;
char tmpBook[50];
struct book
{
    int number,publishDate[5],salesVolume;
    char name[50],publisher[50],author[50];
    double price,sales;
    bool discount;
}books[M];
int records[M<<3][5],cot;//[0]:0-purchase 1-sell [1]:id [2]:number
double salesRecords[M<<3];
double VIP[]={1,0.9,0.8,0.6};
void readString(char *str)
{
    char c=getchar();
    for(;!isdigit(c)&&!isalpha(c);c=getchar());
    for(str[0]=0;c!='\n';c=getchar())str[++str[0]]=c;
}
void printString(char str[])
{
    for(int i=1;i<=str[0];++i)printf("%c",str[i]);
    putchar(10);
}
void printBook(int id)
{
    puts("-The title of the book is:");
    printString(books[id].name);
    puts("-The author of the book is:");
    printString(books[id].author);
    puts("-The publishing house of the book is");
    printString(books[id].publisher);
    puts("-The price of the book is:");
    printf("$%.2lf\n",books[id].price);
    if(books[id].discount)puts("-There is a discount for this book");
    else puts("-There isn't a discount for this book");
    puts("-The publishing date of the book is:");
    for(int i=1;i<=3;++i)printf("%d ",books[id].publishDate[i]);putchar(10);
}
int enquireByName(char goal[])
{
    for(int i=1;i<=totalNumber;++i)
    {
        int flag=1;
        for(int j=1;j<=books[i].name[0];++j)
        if(books[i].name[j]!=goal[j]){flag=0;break;}
        if(flag)return i;
    }
    return 0;
}
void purchase()
{
    int id=0,tmp=0;
    puts("-Please input the title of the book you want to stock (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    if(id=enquireByName(tmpBook))
    {
        puts("-The information of this book has already been recorded in system");
        puts("-So you only need to input the number of newly purchased books");
        scanf("%d",&tmp),books[id].number+=tmp;
    }
    else
    {
        id=++totalNumber;
        for(int i=0;i<=tmpBook[0];++i)books[id].name[i]=tmpBook[i];
        puts("-This is a book that we never purchased before");
        puts("-Please input its detailed information");
        puts("-Please input the author of the book you want to stock (Press \"Enter\" to complete your input)");
        readString(books[totalNumber].author);
        puts("-Please input the publishing house of the book you want to stock (Press \"Enter\" to complete your input)");
        readString(books[totalNumber].publisher);
        puts("-Please input the price of the book you want to stock (Press \"Enter\" to complete your input)");
        scanf("%lf",&books[totalNumber].price);
        puts("-Is there a discount for this book (Input 0 for No or 1 for Yes)");
        scanf("%d",&books[totalNumber].discount);
        puts("-Please input the number of newly purchased books (Press \"Enter\" to complete your input)");
        scanf("%d",&books[totalNumber].number),tmp=books[totalNumber].number;
        puts("-Please input the publishing date of the book you want to stock (Press \"Enter\" to complete your input)");
        puts("-Please input as follow format: Year Month Day (3 numbers divided by space)");
        for(int i=1;i<=3;++i)
        scanf("%d",&books[totalNumber].publishDate[i]);
    }
    records[++cot][0]=0,records[cot][1]=id,records[cot][2]=tmp;
    puts("-Opration ends");
}
void enquireBy(int p)//0-name 1-id
{
    int id;
    if(p)
    {
        puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
        scanf("%d",&id);
        if(id<=0||id>totalNumber){puts("-There is no book numbered this!");return;}
        printBook(id);
        return;
    }
    puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    id=enquireByName(tmpBook);
    if(!id){puts("-There is no book called this!");return;}
    printBook(id);
    puts("-Opration ends");
}
void enquireSalesBy(int p)//0-name 1-id
{
    int id;
    if(p)
    {
        puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
        scanf("%d",&id);
        if(id<=0||id>totalNumber){puts("-There is no book numbered this!");return;}
        printf("-Sell %d books for $%.2lf.\n",books[id].salesVolume,books[id].sales);
        return;
    }
    puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    id=enquireByName(tmpBook);
    if(!id){puts("-There is no book called this!");return;}
    printf("-Sell %d books for $%.2lf.\n",books[id].salesVolume,books[id].sales);
    puts("-Opration ends");
}
void enquireInventoryBy(int p)//0-name 1-id
{
    int id;
    if(p)
    {
        puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
        scanf("%d",&id);
        if(id<=0||id>totalNumber){puts("-There is no book numbered this!");return;}
        printf("-The number of this book in inventory is %d.\n",books[id].number);
        return;
    }
    puts("-Please input the title of the book you want to enquire (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    id=enquireByName(tmpBook);
    if(!id){puts("-There is no book called this!");return;}
    printf("-The number of this book in inventory is %d.\n",books[id].number);
    puts("-Opration ends");
}
void sell()
{
    puts("-Please input the title of the book you want to sell (Press \"Enter\" to complete your input)");
    readString(tmpBook);
    int id=enquireByName(tmpBook),tmp,lev=0;
    if(!id){puts("-There is no book called this!");return;}
    if(books[id].discount)
    {
        puts("-This book can be discounted.");
        puts("-Please input the buyer's VIP level (Press \"Enter\" to complete your input)");
        scanf("%d",&lev);
        if(lev<0||lev>3){puts("-Invalid level!");return;}
    }
    else puts("-This book can't be discounted.");
    puts("-Please input the number of the book you want to sell (Press \"Enter\" to complete your input)");
    scanf("%d",&tmp);
    if(tmp>books[id].number){puts("-No enough books here");return;}
    books[id].number-=tmp;
    books[id].salesVolume+=tmp;
    books[id].sales+=tmp*VIP[lev]*books[id].price;
    records[++cot][0]=1,records[cot][1]=id,records[cot][2]=tmp,salesRecords[cot]=tmp*VIP[lev]*books[id].price;
    puts("-Opration ends");
}
void enquireRecords(int p)//0-purchase 1-sell
{
    if(p)puts("-Sell records:");
    else puts("-Purchase records:");
    for(int i=1;i<=cot;++i)
    if(records[i][0]==p)
    {
        if(p)printf("-Sell");
        else printf("-Purchase");
        printf(" %d ",records[i][2]);
        printString(books[records[i][1]].name);
        if(p)printf("for $%.2lf\n\n",salesRecords[i]);
    }
    puts("-Opration ends");
}
double tool[M][2];
void sortAs(int p)//0-salesVolume 1-sales
{
    for(int i=1;i<=totalNumber;++i)
    {
        tool[i][0]=i;
        tool[i][1]=p?books[i].sales:books[i].salesVolume;
    }
    for(int i=1;i<=totalNumber;++i)for(int j=i+1;j<=totalNumber;++j)
    if(tool[i][1]<tool[j][1])swap(tool[i][1],tool[j][1]),swap(tool[i][0],tool[j][0]);
    for(int i=1;i<=totalNumber;++i)
    printString(books[(int)tool[i][0]].name);
    puts("-Opration ends");
}
void operationList()
{
    puts("-Operate by inputting the corresponding number as follow:");
    puts(" 1 Enquire a book's detailed information through its name.");
    puts(" 2 Enquire a book's sales.");
    puts(" 3 Enquire a book's inventory.");
    puts(" 4 Sort by sales.");
    puts(" 5 Sort by sales Volume.");
    puts(" 6 Enquire the records of stocking.");
    puts(" 7 Enquire the records of exporting.");
    puts(" 8 Purchase one kind of book.");
    puts(" 9 Sell one kind of book.");
    puts(" 0 Operation list.");
    puts("-Input a digit less than 0 to exit the system." );
}
int main()
{
    puts("-Welcome to use PiBook book management system!");
    operationList();
    for(int op,tmp;;)
    {
        scanf("%d",&op);
        if(op<0)break;
        if(op>9){puts("-Invalid input!");continue;}
        if(op&&op<=3)
        {
            puts("-Input the way you want to enquire the book by (0-name 1-ID)");
            scanf("%d",&tmp);
        }
        if(!op)operationList();
        else if(op==1)enquireBy(tmp);
        else if(op==2)enquireSalesBy(tmp);
        else if(op==3)enquireInventoryBy(tmp);
        else if(op==4)sortAs(1);
        else if(op==5)sortAs(0);
        else if(op==6)enquireRecords(0);
        else if(op==7)enquireRecords(1);
        else if(op==8)purchase();
        else if(op==9)sell();
        puts("================================");
    }
    puts("-Thanks for using PiBook book managemnet system!");
    system("pause");
}

结语

正如前面所说,人机交互系统的难点就落在人机交互上,此次编程我也算深有感触。如果删去各种puts()出来的提示信息和非法输入判断,我可以很快结束代码的编写,但除我以外也就没人会使用这个系统了。即便我花费了大量的时间在交互上,这份代码依然存在我前面所说的种种不足,种种bug。当用户完全按照给定指令操作时或许无伤大雅,但是面对刁钻的甲方,以及可能存在的恶意攻击,这份代码很容易就会陷入故障。

管中窥豹,我不得不感慨想要做出一个成熟、完备而安全,能够制止各种非法操作且具有高人性化交互的系统是多么的困难。在IT学习上,我还有很长的路要走……

书店管理系统(C++) 本文详细阐述了一个基于 C++ 的书店管理系统的设计与开发过程。该系统旨在满足书店日常运营中对图书信息的管理需求,包括图书的添加、查询、删除、修改以及显示所有图书信息等功能。通过合理的数据结构设计和功能模块划分,实现了一个简单而实用的书店管理工具。文中介绍了系统的整体架构、各个功能模块的实现细节以及对系统进行的全面测试,测试结果表明该系统能够稳定运行并准确地完成各项预定功能。 阅读详情

相关推荐

简易书店信息管理系统 C++ STL 链表

 头文件与声明 #include&lt;iostream&gt; #include&lt;string&gt; #include&lt;list&gt; #include&lt;sstream&gt; #include&lt;fstream&gt; #include&lt;iomanip&gt; #define MAX_BOOK 100 using namespace std; templat...

qq_41612801的博客 1158

C++11学习 virtual(虚函数)的用法

Virtual虚函数 在面向对象的C++语言中,虚函数(virtualfunction)是一个非常重要的概念。因为它充分体现了面向对象思想中的继承和多态性这两大特性,在C++语言里应用极广。 什么是虚函数呢?虚函数是指一个类中你希望重载的成员函数,当你用一个基类指针或引用指向一个继承类对象的时候,你调用一个虚函数,实际调用的是继承类的版本。——摘自MSDN #include <cstring> #include <string> #include <iostream&..

CHYabc123456hh的博客 1161

简单的书店管理系统(分别使用C++和Java实现)

3、图书信息查询:可通过书名、作者等途径查询某本图书的详细信息(含书名、作者、出版社、页数、最新入库时间、库存量、价格等)。4、自动预警提示(当某图书的库存量为1时自动预警提示)设计一个书店管理系统,能完成书店的日常管理工作。

编程小鹏的博客 548

oracle数据均分成m块

背景,需求,需要将oracle数据均分成m块,并拿其中的第n(n <= m)块 使用ntile函数 SELECT A.* FROM (SELECT T.*, NTILE(9) OVER (ORDER BY T.ROWID ASC) NTI FROM T_XXXX T) A WHERE A.NTI = 3 此sql为把表数据分为9块,取其中的第3块, ...

adaadadsa的博客 898

Java书店管理系统(完整代码)

Java语言实现书店管理系统的完整代码。

AIGC 785

C++网上书店管理系统课程设计与报告

本章节介绍了C++与数据库操作融合实践中的关键概念,包括SQL的基础语法和事务的ACID属性,以及如何在实际编程中应用这些概念。通过掌握这些知识点,开发者可以更有效地利用C++进行数据库交互,实现网上书店管理系统中的数据持久化和高效检索。在下一章节中,我们将继续深入探讨文件读写的高级技巧,这是C++程序中处理持久化存储的另一种重要方式。在复杂的程序中,标准异常类型可能不足以涵盖所有特定情况。在这些情况下,开发者可以定义自己的异常类型。

weixin_42323064的博客 327

【C++】C++书店管理系统(源码+论文)【独一无二】

该图书店管理系统提供了以下功能: 1. 添加图书:管理员可以添加一本新的图书到图书库存中。管理员需要提供图书的名称、作者、出版商、页数和价格。 2. 进货图书:管理员可以为已存在的图书增加库存量。管理员需要提供要进货的图书名称和数量。 3. 出售图书:管理员可以销售图书,减少图书的库存量。管理员需要提供要销售的图书名称和数量。如果库存量不足,系统将显示出售失败的消息。 4. 查询图书:管理员可以查询图书的详细信息,包括图书的名称、作者、出版商、页数、最后进货时间、库存量和价格。管理员需要提供要查询的图

测试开发自动化 1514

计算机网络实验六 RIP 配置实验

Man! What can I say?

AClerk的博客 1599

书店管理系统----涵盖C++大部分主题

文件1:sales_item.h 内容:定义一个销售记录的虚基类 #ifndef SALESITEMS_H #define SALESITEMS_H #include #include using namespace std ; // 定义一个销售记录的抽象类 class Sales_item { public: // 默认构造函数 Sales_item() : sold_

bobopeng 2833

Bochs源码分析 - 4: 使用ida来调试bochs

前言 bochs内部提供了一个调试器,但是这个命令行调试器相当难用,想找一个gui的debugger。第一次是在百度百科的bochs词条中介绍的peter-bochs-debugger调试器(java编写),但是后来发现ida也有一个bochs调试器,因为对ida比较熟悉,就选用此作为bochs调试器。 在配置过程中参考博客 https://blog.csdn.net/cssxn/article/details/90738498 中的配置,但是这是直接发布版本,拿源码编译...

WriteAnything_的博客 2766

从设计到实战:手把手教你用SolidWorks完成一个简易离心泵叶轮的水力设计全流程

本文详细介绍了使用SolidWorks进行简易离心泵叶轮水力设计的全流程,涵盖参数计算、水力设计和三维建模等关键步骤。通过实际案例演示,帮助机械设计工程师和学生掌握从理论到实践的转化技巧,特别适合低比转速离心泵叶轮的设计需求。

weixin_30621711的博客 245

图书店管理系统:基于C++的开源项目介绍

图书店管理系统:基于C++的开源项目介绍 1. 项目基础介绍及编程语言 本项目是一个开源的图书店管理系统,采用C++编程语言进行开发。该系统旨在为图书店提供一个便捷的管理解决方案,帮助店主更高效地管理图书库存、销售、供应商和会员信息。 2. 核心功能 图书管理:系统可以添加、编辑、删除和查询图书信息,包括图书的ID、名称、作者、价格和数量等。 供应商管理:记录供应商的详细信息,如ID、名称、电话...

gitblog_00235的博客 413

RK3568 i2s TDM数据抓取

一.RK 系列芯片 I2S 支持列表二. Simple Card Simple Card 是 ASoC 通用的 machine driver,可支持大部分标准声卡的添加1.协议格式设置PropertyValuestring设置协议格式Formati2si2s 标准格式right_ji2s 右对齐格式left_ji2s 左对齐格式dsp_apcm delay 1 bit 格式dsp_bpcm no delay 格式pdmpdm 格式2.mclk-fs 设置Property。

yinsui1839的博客 2747

C#书店售卖系统

这是我学习C++时的结课课程设计作业,但是由于当时自己的电脑刚升级了Win11的系统(网上查的数据库不兼容Win11),自己也装了好几次都不成功,所以才用的老师的电脑做的项目,导致现在只有源代码和一些数据库数据表和日志,懂得怎么迁移数据库的朋友可以动手把数据库并到自己的电脑上就可以直接运行系统了。在实体书店的日常管理中,传统的人工操作存在着诸如工作量大、错误率高、效率低下等很多弊端,因此开发一款辅助实体书店进行管理的系统,实现实体书店的自动化管理显得十分重要。仓库和供应商的模块都能进行增删改的操作[2]。

Lu_time的博客 851

1、初探 Tiny Machine Learning

Tiny Machine Learning(TinyML)是机器学习与嵌入式系统的融合领域,致力于在资源受限的微控制器上运行AI模型。本文介绍了机器学习基础、TinyML的核心概念、应用领域(如智能家居、工业物联网、医疗保健)、面临的挑战(如资源限制、模型压缩、数据质量),以及从硬件准备到模型部署的实践步骤。通过利用训练与推理的资源不对称性,可在PC上训练模型并部署至低功耗设备进行实时推理,推动边缘智能的发展。

loss4bartender的博客 130

第 10 篇:深度学习的“军火库”——CNN、RNN与Transformer,AI如何看懂世界?

深度学习的革命,不是依赖单一的通用大脑,而是为不同任务打造了专属“军火库”:CNN用“局部感知”看懂图像,RNN用“循环记忆”理解序列,而Transformer则用“全局注意力”开启了AIGC时代。理解这些架构,不是记忆孤立的技术,而是洞察AI从“专才”走向“通才”的进化脉络。

maqh_csdn的博客 792

开源项目常见问题解决方案:书店管理系统

开源项目常见问题解决方案:书店管理系统 一、项目基础介绍 本项目是一个书店管理系统,使用C++编程语言开发。项目旨在帮助书店管理书籍、供应商、员工、会员、销售和采购等信息。该系统基于MySQL数据库进行数据存储和管理。 二、新手常见问题及解决步骤 问题1:如何配置MySQL数据库? 问题描述: 新手在使用该项目时,需要配置MySQL数据库。 解决步骤: 下载并安装MySQL数据库,可以从MySQ...

gitblog_00714的博客 911

实时系统vxWorks - 虚拟机环境搭建

概述VxWorks 操作系统是美国WindRiver公司于1983年设计开发的一种嵌入式实时操作系统(RTOS),是嵌入式开发环境的关键组成部分。良好的持续发展能力、高性能的内核以及友好的...

不只会拍照的程序猿 7867

C++项目学习(机器人方向)

因此,下面提到的是一些适合初学者、中级和有经验的人的有趣且简单的C++项目。很少有是容易的,也很少有有点棘手的,但你的工作是修补每个项目,以探索你隐藏的技能和才能。但是您必须非常注意您的图形,因为它是您的书店管理系统应用程序的主要部分。不同卡的验证操作不同,因此确定它是什么类型的卡,然后检查输入的号码是否是有效的信用卡号码是要走的路。该项目是一个简单的控制台应用游戏项目,是开放图形库和C++编程的一个很好的演示。游戏的源代码是项目格式,这意味着它有不同的C++文件,以及每个用户定义的头文件和函数。...

zhangrelay的专栏 6257

YOLOv11模型剪枝实战:让检测速度翻倍,精度仅降1%的终极优化教程

模型剪枝是YOLOv11落地边缘场景的“关键一步”——它让模型在“瘦身”的同时,几乎不损失精度。从稀疏化训练到通道剪枝,再到工程部署,本教程已为你打通全流程。现在就动手尝试,让你的YOLOv11模型在嵌入式设备、移动端上也能“飞起来”——相信我,当你看到剪枝后的模型在资源受限设备上仍能精准检测时,你会明白这份技术的价值。

m0_64661770的博客 723

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

书店管理系统

注意带上头文件Book.c// 初始化title = "";time = "";pages = 0;//设置图书信息//获取图书信息。

Wa1t7的博客 730

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

C++书店管理系统[2025-06-08]

摘要:这是一个基于C++的控制台书店管理系统,主要功能包括书籍信息管理(增删改查)、库存管理(进货/销售)、会员管理(积分折扣)和销售统计(报表生成)。系统要求可扩展性强,便于添加新书籍类别和功能,同时界面需简洁易操作。该系统适用于中小型书店业务管理,源码可通过指定链接获取。[字数:150]

程序设计 182

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

C语言程序设计--书店管理系统

采购后,把采购的图书数据输入到系统:读取条形码(ISBN号),如果该书已经存在(书号已经在数据库也就是bk数组),直接显示该图书信息,输入数量后,修改书库中的图书数量;书店为了能实现日常的经营,经常涉及到到事物及应该具有的功能是:图书入库(进书采购时)、图书销售、查看图书的库存情况(清单)、图书删除、数据保存、数据备份等功能。由图中可见,所有的功能操作都围绕着bk数组作为数据基础,数组bk的数据来自文件bookdata.txt,bk数组数据的变化,最终也要保存在该文件。/*数量(单位:册)*/

qq_63964231的博客 1105
上一篇: 【C++/Python 双语言实现】Luogu5092 Cube Stacking
下一篇: Python基本图形绘制:turtle库
ShadyPi
博客等级 码龄9年 1万+粉丝 637原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ShadyPi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值