C语言笔记本电脑销售系统课设(附源码).docx

上传人:wj 文档编号:357559 上传时间:2023-04-29 格式:DOCX 页数:16 大小:118.15KB
下载 相关 举报
C语言笔记本电脑销售系统课设(附源码).docx_第1页
第1页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第2页
第2页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第3页
第3页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第4页
第4页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第5页
第5页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第6页
第6页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第7页
第7页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第8页
第8页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第9页
第9页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第10页
第10页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第11页
第11页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第12页
第12页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第13页
第13页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第14页
第14页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第15页
第15页 / 共16页
C语言笔记本电脑销售系统课设(附源码).docx_第16页
第16页 / 共16页
亲,该文档总共16页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

C语言笔记本电脑销售系统课设(附源码).docx

《C语言笔记本电脑销售系统课设(附源码).docx》由会员分享,可在线阅读,更多相关《C语言笔记本电脑销售系统课设(附源码).docx(16页珍藏版)》请在冰点文库上搜索。

C语言笔记本电脑销售系统课设(附源码).docx

C语言笔记本电脑销售系统课设

项目说明

本系统基于C语言开发,适用于刚入门的C语言新手项目课设,

开发软件采用VC++6.0开发,VS,DEVC++等均可运行。

(书生)

项目运行截图开始界面

1

新建笔记本信息

2

删除笔记本信息

退出系统

3

代码界面截图

完整源码

#include

#include

#include

#include

structComputer

{

charName[100];

charBrand[100];

charType[100];

intSell_quantity;

floatPurchase_price;

intRemain_quantity;

floatSell_price;

floattotal_money;

structComputer*next;

};

#defineLENsizeof(structComputer)

voidCREAT(void);

voidMENU(void);

voidFIND(structComputer*head);

voidSAVE(structComputer*head);voidADD(structComputer*head);

voidCHANGE(structComputer*head);

voidDELETe(structComputer*head);

voidHIGH(structComputer*head);

voidSEARCH(structComputer*head);

voidSELL(structComputer*head);

intmain()

{

intnumber,count;

FILE*fp;

system("modeconcols=120lines=100"); //行列

system("colorF0");

printf("\n--- 欢迎进入笔记本电脑销售管理系统

---\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

printf("

版本型号:

V2.1.5\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf("·准备好后请按回车键开始(请不要乱按其他键,否则会造成程序错误)\n");

printf("·PleaseentertheEnterkeytostart!

");

getchar();

if((fp=fopen("SellRecord.txt","rb"))==NULL)

{

printf("

+-+\n\n

");

printf(" |提示:

您是第一次使用该系统,请先录入笔记销

售信息!

|\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF9);

printf(" | ·服务编

号:

|\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF2);

printf(" | 1.新建

笔记本电脑信息 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF6);

printf(" | 2.退出

系统 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf("

+-+\n\n

");

printf(" Input:

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%d",&number);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

if(number==1)CREAT();

elseif(number==2)exit(0);

else

{

printf(" 未查到此编号,回车键退出系统!

");

getchar();

exit(0);

}

}

else

{

fclose(fp);

MENU();

}

return0;

}

voidMENU(void)

{

intnumber;

FILE*fp;

intt;

structComputer*p1,*p2,*head;

p1=(structComputer*)malloc(LEN);

head=p1;

if((fp=fopen("SellRecord.txt","rb"))==NULL)

{

printf(" 未找到该信息!

回车键退出程序\n");

getchar();

exit(0);

}

while(!

feof(fp))

{

if(fread(p1,LEN,1,fp)!

=1)break;

p1->next=(structComputer*)malloc(LEN);

if(p1->next==NULL)

{

printf(" error:

回车键退出程序\n");

getchar();

exit(0);

}

p2=p1;

p1=p1->next;

}

p2->next=NULL;

fclose(fp);

system("CLS");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf("\n--- 欢迎进入笔记本电脑销售管理系统

---\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

printf("

版本型号:

V2.1.5\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf("

+-+\n\n

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

printf(" | ·服务编号:

|\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF2);

printf(" | 1.添加笔记

本电脑信息 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF9);

printf(" | 2.删除笔记

本电脑信息 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF6);

printf(" | 3.修改笔记

本电脑信息 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

printf(" | 4.查询笔记

本库存现状 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF4);

printf(" | 5.查询目前

销量最高的笔记本 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF1);

printf(" | 6.查询某品

牌笔记本库存 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFD);

printf(" | 7.笔记本销

售 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF5);

printf(" | 8.退出系统

|\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF8);

printf(" | 9.格式化系

统 |\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf("

+-+\n");

printf(" Input:

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%d",&number);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

if(number==1)ADD(head);

elseif(number==2) DELETe(head);

elseif(number==3) CHANGE(head);

elseif(number==4) FIND(head);

elseif(number==5) HIGH(head);

elseif(number==6) SEARCH(head);

elseif(number==7) SELL(head);

elseif(number==8) exit(0);

elseif(number==9)

{

getchar();

remove("SellRecord.txt");

printf(" 请按回车键退出系统,并重新启动程序

\n");

getchar();

exit(0);

}

else

{

printf(" 未查到此编号,回车键退出系统!

\n");

getchar();

getchar();

exit(0);

}

}

voidCREAT(void)

{

structComputer*p1,*p2,*head=NULL,*p=NULL;

FILE*fp;

p1=p2=(structComputer*)malloc(LEN);

printf("-

\n");

fp=fopen("SellRecord.txt","wb+");

printf(" ·请按如下格式输入来添加笔记本销售信息:

\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF1);

printf(" 产品名称产品品牌产品型号销售数量进

价库存数量售价\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf(" ·当输入产品名称为0时则为停止录入!

\n\n");

printf(" Input:

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%s",p1->Name);

while(p1->Name[0]!

='0')

{

scanf("%s%s%d",p1->Brand,p1->Type,&p1->Sell_quantity);

scanf("%f%d%f",&p1->Purchase_price,&p1->Remain_quantity,&p1->Sell_price);

p1->total_money=p1->Sell_quantity*p1->Sell_price;

if(head==NULL)

head=p1;

else

p2->next=p1;

p2=p1;

p1=(structComputer*)malloc(LEN);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf(" Input:

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%s",p1->Name);

}

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

fclose(fp);

p2->next=NULL;

free(p1);

SAVE(head);

}

voidSAVE(structComputer*head)

{

structComputer*p;

ints=0,k;

FILE*fp;

p=head;

if((fp=fopen("SellRecord.txt","wb"))==NULL)

{

printf(" 未找到该信息!

回车键退出程序\n");

getchar();

exit(0);

}

else

{

while(p!

=NULL)

{

fwrite(p,LEN,1,fp);

p=p->next;

}

fclose(fp);

printf(" 保存成功!

请按回车键继续!

\n");

getchar();

getchar();

if((fp=fopen("SellRecord.txt","rb"))==NULL)

{

printf(" 未找到该信息!

回车键退出程序\n");

getchar();

exit(0);

}

MENU();

}

}

voidFIND(structComputer*head)

{

structComputer*p;

system("CLS");

printf("-

\n");

printf(" 请按回车键查

看!

");

getchar();

getchar();

p=head;

if(head==NULL)

{

printf(" 未找到该信息!

回车键退出程序\n");

getchar();

exit(0);

}

else

{

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF2);

printf("

+---+\n"

);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf(" |产品名称 产品品牌 产品型号

销售数量进价库存数量售价金额|\n");

while(p!

=NULL)

{

p->total_money=p->Sell_quantity*p->Sell_price;

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF2);printf("

+---+\n"

);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);printf("

|%-16s%-16s%-16s%-6d%-12.2f%-6d%-12.2f%-12.2f|\n",p->Name,p->Brand,p->Type,p->Sell_quantity,p->Purchase_price,p->Remain_quantity,p->Sell_price,p->total_money);

p=p->next;

}

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF2);

printf("

+---+\n"

);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

}

printf(" 请按回车键继

续");

getchar();

MENU();

}

voidADD(structComputer*head)

{

structComputer*p1,*p2;

FILE*fp;

printf("-

\n");

printf(" ·请按如下格式输入来新增一条笔记本销售信

息:

\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF1);

printf(" 产品名称产品品牌产品型号销售数量进

价库存数量售价\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

p1=head;

if(head==NULL)

{

printf(" 未找到该信息!

回车键退出程序\n");

getchar();

exit(0);

}

else

{

while(p1->next!

=NULL)p1=p1->next;

p2=(structComputer*)malloc(LEN);

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf(" Input:

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%s",p2->Name);

printf("\n");

scanf("%s%s%d",p2->Brand,p2->Type,&p2->Sell_quantity);

scanf("%f%d%f",&p2->Purchase_price,&p2->Remain_quantity,&p2->Sell_price);

p1->total_money=p1->Sell_quantity*p1->Sell_price;

p1->next=p2;

p2->next=NULL;

}

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

fp=fopen("SellRecord.txt","wb+");

fclose(fp);

SAVE(head);

}

voidDELETe(structComputer*head)

{

structComputer*p;

charch1[100],ch2[100],ch3[100],flag=0;

FILE*fp;

p=head;

printf("-

\n");

printf(" ·请按如下格式输入来删除一条笔记本销售信

息:

\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF1);

printf(" 产品名称产品品牌产品型号\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf(" Input:

");

getchar();

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%s%s%s",ch1,ch2,ch3);

printf("\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

if(strcmp(ch1,p->Name)==0&&strcmp(ch2,p->Brand)==0&&strcmp(ch3,p->Type)==0)

{

head=p->next;

flag=1;

}

else

{

while(p->next!

=NULL)

{

if(strcmp(ch1,(p->next)->Name)==0&&strcmp(ch2,(p->next)->Brand)==0&&strcmp(c

h3,(p->next)->Type)==0)

{

p->next=(p->next)->next;

flag=1;

}

if(flag==1)break;

p=p->next;

}

}

if(flag==0)printf(" 未找到该信息!

\n");

fp=fopen("SellRecord.txt","wb+");

fclose(fp);

SAVE(head);

}

voidCHANGE(structComputer*head)

{

structComputer*p;

charch1[100],ch2[100],ch3[100];

inta,b,flag=0;

floatc,d;

FILE*fp;

p=head;

printf("-

\n");

printf(" 请按如下格式输入来修改一条笔记本销售信

息:

\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF1);

printf(" 产品名称产品品牌产品型号销售数量(修改

后)进价(修改后)库存数量(修改后)售价(修改后)\n\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

printf(" Input:

");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xFC);

scanf("%s%s%s%d%f%d%f",ch1,ch2,ch3,&a,&c,&b,&d);

printf("\n");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),0xF0);

while(p!

=NULL)

{

if(strcmp(ch1,p->Name)==0&&

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2