资源描述:
《汽车销售系统c++代码.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include"iostream"#include"stdio.h"#include"fstream"#include"stdio.h"#include"vector"#includeusingnamespacestd;/*函数声明*/#defineCAPACITY50/*车库容量*/voidopen_remain();/*打开文件传递数据*/voidsale_car();/*销售车辆*/voidadd_car();/*添加车辆*/voiddel_car();voidxg_ca
2、r();voidsearch_car();/*查询车辆*/voidfind_name();/*以车名查找*/voidfind_price();/*按价格查找*/voidsort_car();/*模糊查询*/voidprint_all();/*打印车库中所有存车*/voidprint(int);/*打印相应的车的信息*/voidprintmenu();/*打印菜单*/voidprint_date();/*打印当日售车情况*/voidstore_to_remain();/*保存数据,将剩余车辆保存在r
3、emain.txt中*//*宏定义,结构体,全局静态变量声明*/structCAR{intID;charname[20];intjprice;intsprice;intnumber;charcs[20];charjdata[20];};inti;staticstructCARcar[CAPACITY];/*存储所有的车*/staticCAR*p=car;staticCAR*p1=p;staticstructCARsale_cars[CAPACITY];/*存储当天买出的车*/staticintsi
4、ze=0;/*存车的种数*/staticintsize1=0;/*售车的种数*/staticintnow=0;/*销售车的数目*/staticinttotal=0;/*初定义*/#defineboolintvoidkey(){/*建立初始密码*/FILE*fp;charchs[10]="1234";if((fp=fopen("code.txt","r"))==NULL){fp=fopen("code.txt","w");fputs(chs,fp);}fclose(fp);}voidkeychang
5、e()/*修改密码*/{/*密码修改系统*/FILE*fp;charcha[10],chb[10],chc[10],chd[10];inti=0;fp=fopen("code.txt","r");fgets(cha,10,fp);fclose(fp);printf("");printf("");printf("");printf("************************************");printf("**");printf("**");printf(
6、"*课程序设计密码修改窗口*");printf("**");printf("**");printf("**");printf("************************************");printf("");printf("");printf("请输入密码:");scanf("%s",&chb);if(strcmp(cha,chb)==0){printf("输入新密码:");scanf("%s",&chc);printf("确认新密码:");scan
7、f("%s",&chd);while(strcmp(chc,chd)<0
8、
9、strcmp(chc,chd)>0){i++;if(i==3){printf("");printf("密码修改失败!!!");return;}printf("输入新密码:");scanf("%s",&chc);printf("确认新密码:");scanf("%s",&chd);}if(strcmp(chc,chd)==0){fp=fopen("code.txt","w");fputs(chd,fp);fclose(
10、fp);printf("");printf("密码修改成功!!!!");}getchar();}else{printf("密码错误无权修改!谢谢使用!");scanf("%*c");return;}}voidjiemian()/*进入界面*/{intfound=0;chara[10],b[10];FILE*fp;key();fp=fopen("code.txt","r");fgets(b,10,fp);rewind(fp);printf("");prin