资源简介

列车时刻表管理C语言源代码,功能不是很多,不过程序出错率比较低,

资源截图

代码片段和文件信息

/*================================================================*\
|******************************************************************|
|*             Train‘s Time List Manage(列车时刻表管理)    ********|
|**                                                            ****|
|****                             By Snowing.NK@Frozenworld      **|
|********         From: 2007.07.09            Date: 2007.07.11    *|
|******************************************************************|
\*================================================================*/


/*================================================================*\
|******************************************************************|
|**                                                              **|
|*       请使用命令提示符(CMD.exe9X为command.com)运行本程序      *|
|**                                                              **|
|******************************************************************|
\*================================================================*/


/******************************************************************\
|***************************code_start*****************************|
\******************************************************************/

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*\
\*++++++++++++++++++++++include+start++++++++++++++++++++++++++++*/
#include “math.h“
#include “stdio.h“
#include “conio.h“
#include “string.h“
#include “malloc.h“
//#include “windows.h“//not use

/*+++++++++++++++++++++++include+end+++++++++++++++++++++++++++++*\
\*+++++++++++++++++++++++define+start++++++++++++++++++++++++++++*/

//constant‘s define(常量的定义)
#define MaxLen 20 //the max of string
#define lenid 10 //the max of train‘s coach number‘s string 
#define lentm 12 //the max of time‘s string

//time type
typedef struct{
int hour; //hour
int minute; //minute
}Times;

//data saved type
typedef struct{
char ID[lenid]; //train‘s coach number
Times lvtime; //leave time
Times avtime; //arrive time
char start[MaxLen]; //start station
char end[MaxLen]; //end station
}datatype;

//creat a link List
typedef struct linkList{
datatype *train; //train infomation
linkList *next; //next point
}linkList;


/*+++++++++++++++++++++++define+end++++++++++++++++++++++++++++++*\
\*+++++++++++++++++++++Function+start++++++++++++++++++++++++++++*/


//creat a linklist
linkList* CrtList()
{
linkList* L;
L=(linkList *)malloc(sizeof(linkList));
L->next=NULL;
return L;
}

//get the lenth of the list
int LenList(linkList *L)
{
int n=0;
while(L->next!=NULL)
{
L=L->next;
n++;
}
return n;
}

//insert a data into the list
int InsList(linkList* Ldatatype *Item)
{
int i=0;
linkList *temp*H=NULL;
datatype *tmp;
temp=CrtList();
tmp=(datatype*)malloc(sizeof(datatype));

//to memory
strcpy(tmp->IDItem->ID);
tmp->avtime=Item->avtime;
tmp->lvtime

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .CA....       204  2007-07-12 10:33  TrainList\Debug\List.dat

    .CA....    229464  2007-07-12 09:50  TrainList\Debug\TrainList.exe

    .CA....    306100  2007-07-12 09:50  TrainList\Debug\TrainList.ilk

    .CA....     63683  2007-07-12 09:50  TrainList\Debug\TrainList.obj

    .CA....    230552  2007-07-12 09:33  TrainList\Debug\TrainList.pch

    .CA....    549888  2007-07-12 09:50  TrainList\Debug\TrainList.pdb

    .CA....    156672  2007-07-12 09:50  TrainList\Debug\vc60.idb

    .CA....     77824  2007-07-12 09:50  TrainList\Debug\vc60.pdb

     文件        136  2007-07-11 10:24  TrainList\List.dat

    .CA....     29805  2007-07-12 13:38  TrainList\TrainList.cpp

    .CA....      4007  2007-07-09 22:51  TrainList\TrainList.dsp

     文件        543  2007-07-09 17:10  TrainList\TrainList.dsw

    .CA....     58368  2007-07-12 10:41  TrainList\TrainList.ncb

    .CA....     49664  2007-07-12 10:41  TrainList\TrainList.opt

    .CA....      1318  2007-07-12 09:50  TrainList\TrainList.plg

    .C.D...         0  2007-07-11 17:25  TrainList\Debug

    .C.D...         0  2007-07-13 08:02  TrainList

----------- ---------  ---------- -----  ----

              1758228                    17


评论

共有 条评论