C 语言 数据结构 求助阿……

来源:百度知道 编辑:UC知道 时间:2024/06/01 05:19:11
① 问题描述:设计数据结构及算法完成某个汽车租借公司日常工作的组织与管理。
② 功能要求:用三个链表组织三种状态的汽车。
•可以租借(available for rent)
•已借(rented)
•修理中(in repair)
其中在available队列中汽车应该依据汽车行驶过的路程进行排序,行驶路程最少的汽车排在最前面。在rented队列中的汽车应依据其预期返回时间进行排序,排在最前的应是预期最早返回的汽车。
③ 能够实现租借的日常事务:引入新车,租借,收费,修理等。
④ 租借收费应根据汽车行驶的路程及借去的时间综合计算得出,路程收费标准如下:
1. 低于100Km收费20.00元
2. 100Km以外的路程枚Km收费0.15元
⑤ 其他辅助操作:汽车查询,打印全部信息。
⑥ 管理系统应有完整地界面。

我实在是没办法了才来知道求助的……
我总共只有17分了所以我只能给这么多分了……谢谢好心人啊……

我是楼主……这是我写的……我可不是偷懒不想自己做……
为什么123按了都没有反应阿……急死我了……
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#include <string.h>

typedef struct _car_t
{
int id;
int lucheng;
int lenttime;
int returntime;
struct _car_t * next;
}car_t;

typedef struct _carlist_t
{
car_t *head;
int car_num;
}carlist_t;

typedef struct _car_company
{
carlist_t available;
carlist_t rented;
carlist_t repaired;
int total_car_num;
}car_campany;

#include "list.h"

int add_newcar(carlist_t *list, car_t *newcar)
{
assert(list && newcar);
if(list->car_num == 0)
{
list->head = (car_t *)calloc(1, sizeof(car_t));
list->head->next = 0;
}
newcar->next = list->head->next;
list->head->next = newcar;
list->car_num ++;