#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<bios.h>
#include<conio.h>
#define K_Alt_F 8448
#define K_Alt_E 4608
#define K_Alt_S 7936
#define K_Alt_H 8960
#define K_Alt_X 11520
#define K_F1 15104
#define K_F2 15360
#define K_F3 15616
#define K_UP 18432
#define K_DOWN 20480
#define K_LEFT 19200
#define K_RIGHT 19712
#define K_ESC 283
#define K_ENTER 7181
#define K_n 12654
#define K_s 8051
#define K_w 4471
#define K_q 4209
#define K_m 12909
#define K_r 4978
#define K_x 11640
#define K_N 12622
#define K_S 8019
#define K_W 4439
#define K_Q 4177
#define K_M 12877
#define K_R 4946
#define K_X 11608
#define K_T 100 /* temp */
#define K_V 200 /* temp */
#define K_t 300 /* temp */
#define K_v 400 /* temp */
#define K_1 561
#define K_2 818
#define K_3 1075
#define K_4 1332
#define K_5 1589
#define K_6 1846
#define K_a 7777
#define K_b 12386
#define K_c 11875
#define K_d 8292
#define K_e 4709
#define K_f 8550
#define K_g 8807
#define K_h 9064
#define K_i 5993
#define K_j 9322
#define K_A 7745
#define K_B 12354
#define K_C 11843
#define K_D 8260
#define K_E 4677
#define K_F 8518
#define K_G 8775
#define K_H 9032
#define K_I 5961
#define K_J 9290
void node_crt(); /*建立链表函数*/
void kind_node_crt();/*建立汽车型号信息链表的函数*/
void sell_node_crt();/*建立汽车销售基本信息链表的函数*/
void fee_node_crt();/*建立车款缴费信息链表的函数*/
void sort();/*把十字交叉链表排序的函数*/
void sort_kind(); /*汽车型号链表排序函数*/
void sort_sell(char *);/*汽车销售信息链表排序函数*/
void sort_fee(char *,char *); /*车款缴费链表排序函数*/
void insert(); /* 插入函数 */
void insert_kind(); /* 插入汽车型号链表 */
void insert_sell(); /* 插入汽车销售信息链表 */
void insert_fee(); /* 插入车款缴费信息链表 */
void modify(); /* 修改函数 */
void modify_kind(); /* 修改汽车型号信息函数 */
void modify_sell(); /* 修改汽车销售信息函数 */
void modify_fee(); /* 修改车款缴费信息函数 */
void del(); /* 删除函数 */
void del_kind(); /* 删除汽车型号结点的函数 */
void del_sell(); /* 删除汽车销售结点的函数 */
void del_fee(); /* 删除车款缴费结点的函数 */
void del_node(); /* 删除整个十字链表的函数 */
int my_strstr(char [],char []);/*检验一个字符串是否是另一个字符串子串的函数*/
void search(); /* 查询函数 */
void search_kind(); /* 车型查询函数 */
void search_sell(); /* 销售信息查询函数 */
void fnew(); /* 新建十字链表,并询问是否保存原来的数据 */
void save(); /* 保存当前十字链表的函数,默认路径D:\TC\projects\s.txt */
void write_to(); /* 自定义路径保存十字链表 */
/* 菜单部分的函数 */
void menu();
void menu_main(); /* 主菜单 */
void menu_file(); /* file子菜单 */
void menu_edit(); /* edit子菜单 */
void menu_statistics(); /* statistics子菜单 */
void menu_help(); /* help子菜单 */
void f_file(); /* 对file菜单的操作函数 */
void f_edit(); /* 对edit菜单的操作函数 */
void f_statistics(); /* 对statistics菜单的操作函数 */
void f_help(); /* 对help菜单的操作函数 */
void sales_volume(); /* 统计车型的销售量的函数 */
void total_sales(); /* 统计车型的总销售款 */
void arrears_buyers(); /*列出欠缴车款的客户基本信息 */
int str_num(char *,int); /* 把字符串的前int个字符转换成数字 */
void about_sys(); /* 该程序的使用说明 */
void copyright(); /* 关于该程序的信息 */
void esc_menu(); /* 拉起当前的下拉菜单 */
void boxf(int,int,int,int); /* 在下拉菜单中画框 */
void upbar(int,int); /* 光条上移函数 */
void downbar(int,int); /* 光条下移函数 */
void set_blue(int,int,int); /* 把窗口最后一排的背景色设置为蓝色 */
int get_key(); /* 读键函数 */
typedef struct kind_info{
char car_name[20]; /*车型*/
int car_weight; /*重量*/
int seat; /*座位数*/
int car_lengh; /*车长*/
int car_width; /*车宽*/
int car_height; /*车高*/
struct kind_info *next;
struct sell_info *sell;
}KIND_INFO; /*汽车型号信息*/
typedef struct sell_info{
char car_num[20]; /*汽车编号*/
char car_name[20]; /*车型*/
char car_color[10]; /*颜色*/
char sell_date[12]; /*销售日期*/
char buyer_name[20];/*购买客户姓名*/
char buyer_num[18]; /*客户身份证号*/
char buyer_pho[20]; /*客户联系电话*/
float price; /*销售价格*/
struct sell_info *next;
struct fee_info *fee;
}SELL_INFO; /*汽车销售基本信息*/
typedef struct fee_info{
char car_num[20]; /*汽车编号*/
char fee_date[12]; /*缴费日期*/
float fee; /*缴费金额*/
float rem_fee; /*未交余款*/
char payee[20]; /*收款人*/
struct fee_info *next;
}FEE_INFO; /*车款缴费信息*/
KIND_INFO *k_head=NULL;
void node_crt()
{
int key=0;
printf("1:creat car kind clain\n2:creat car sell clain\n");
printf("3:creat car fee clain\nESC:break\n");
key=get_key();
while(key!=K_ESC)
{
key=get_key();
if(key==K_1) kind_node_crt();
if(key==K_2) sell_node_crt();
if(key==K_3) fee_node_crt();
}
}
void kind_node_crt()
{
KIND_INFO *p1,*p2;
float f;
k_head=NULL;
p1=k_head;
while(1)
{
printf("Press ESC to break,other key to continue......\n");
if(get_key()==K_ESC) break; /* 按ESC键退出 */
p2=(KIND_INFO *)malloc(sizeof(KIND_INFO));
p1->next=p2;
p1=p2;
p2->next=NULL;
printf("The kind of car is:");
scanf("%s",p1->car_name);
printf("The weight of this car is:");
scanf("%d",&p1->car_weight);
printf(" The number of seats is:");
scanf("%d",&p1->seat);
printf("The lengh of this car is:");
scanf("%d",&p1->car_lengh);
printf("The width of this car is:");
scanf("%d",&p1->car_width);
printf("The height of this car is:");
scanf("%d",&p1->car_height);
}
sort_kind();
}
void sell_node_crt()
{
SELL_INFO *p1,*p2;
KIND_INFO *p;
char car_name[20];
int t=0;
printf("input the name of a kind of cars:");
scanf("%s",car_name);
p=k_head->next;
if(p)
t=1;
else
t=-1;;
if(t==1)
{
p1=(SELL_INFO *)malloc(sizeof(SELL_INFO));
p->sell=p1;
while(1)
{
printf("Press ESC to break,other key to continue......\n");
if(get_key()==K_ESC) break;
printf("The car number is:");
scanf("%s",p1->car_num);
printf("The color is:");
scanf("%s",p1->car_color);
printf("The sell date is:");
scanf("%s",p1->sell_date);
printf("The name of the buyer is:");
scanf("%s",p1->buyer_name);
printf("The ID number of the buyer is:");
scanf("%s",p1->buyer_num);
printf("The phone number of the buyer is:");
scanf("%s",p1->buyer_pho);
printf("The price of the car is:");
scanf("%s",p1->price);
p2=(SELL_INFO *)malloc(sizeof(SELL_INFO));
p1->next=p2;
p1=p2;
p2->next=NULL;
}
}
if(t==-1)
{
printf("Press ESC to break,other keys to continue......\n");
if(get_key()!=K_ESC)
node_crt();
}
}
void fee_node_crt()
{
FEE_INFO *p1,*p2;
SELL_INFO *p0;
KIND_INFO *p=k_head->next;
char car_name[20],car_num[20];
float fee;
printf("Input the name of the kind of cars:"); /* 查找车型 */
scanf("%s",car_name);
while(p)
{
if(strcmp(car_name,p->car_n