最近学了一手数据结构,开始试着构建链表的应用。
参考资料:(1)单链表实现的学生管理系统https://blog.csdn.net/y____xiang/article/details/80045000
(2)C++如何获取系统时间https://blog.csdn.net/chen134225/article/details/79396149
#include<iostream>
#include<string>
#include<time.h>
using namespace std;
#pragma warning(disable:4996)
struct Carinfo {//车辆信息存储结构
int len = 0;
char carname[20];
double dur = 0.0;
double start = 0.0;
double end = 0.0;
int inyear; int inmonth; int inday;
int inhour; int inmin; int insec;
Carinfo *next;//下一辆车
};
Carinfo* createcarinfo()//构建链表
{
Carinfo *carinfo = new Carinfo;
carinfo->next = NULL;
return carinfo;
}
void gettime(Carinfo*n)//better获取当前时间
{
struct tm*local;
time_t t;
t = time(NULL);
local = localtime(&t);
n->inyear = local->tm_year + 1900;
n->inday = local->tm_mday;
n->inmonth = local->tm_mon + 1;
n->inhour = local->tm_hour;
n->inmin = local->tm_min;
n->insec = local->tm_sec;
clock_t start;//计时函数
start =