资源描述:
《c语言课程设计《高速公路联网收费系统》代码》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、作者:吴侠志就读院校:东莞理工学院#include"stdafx.h”#defineNUM4#definemaxJen8#include#include^include#include#include#include〈conio.h〉char*mytime(structtm*timeptr);//获取系统时间的闹数voidDelay(intn);//延时函数char*filename(intstartkey);voidinitialize(structcar*cars,intnum
2、,FILE*fp);///初始化函数intrefer(structcar*cars,intstartkey);"查询intkm[101={0,0,82,162,288,368,391,514,800,867};/*记录各站与首站的里程,单位:km*/doubleprice[6]={0.0,0.6,1.2,1.8,24,3.0};/*记录各类车的里程价位,单位:元/辆公里*/char*address[10]={"0”,"湛江","茂名","阳江","开平","佛山","广州","深圳'"汕头","汾水’•};char*kind[6]={"特殊车","一类车","二类车
3、","三类车","四类车","五类车••};structcar{intcard_num;/*卡号*/intcar_type;intstation_in;chartime—in
4、76"
5、;intstation_out;chartime_out[26];charisjn;doublemoney;intflag;}car$[9*NUM+l];intnum=0;intpass=0;intmain(intargc,char*argv门){inti,key,choice,j,k,m,size;doublepay,money;charenter,pwd[max_len+1],pa
6、ssword[max_len+1],ch;FILE*fp;fp=fopen("标记.txt",’’a+n);fclose(fp);fp=fopen("记录.txt",”a+”);fclose(fp);printf("t欢迎登录广东同三高速公路联网收费系统tT);printf(•’printf("printf("printf(nprintff1.湛江2.茂名3.阳江1n);4.开平5.佛山6.广州1-);7.深圳8•汕头9.汾水关1n);l");M);printf("请选择所在站点,并输入该序号:n);intstartkey;while(l)f
7、flush(stdin);while(scanf("%d%c’’,&startkey,&enter)==O
8、
9、enter!=t,)printf(’’terror!"inputagain:"fflush(stdin);if(startkey==l
10、
11、startkey==2
12、
13、startkey==3
14、
15、startkey==4
16、
17、startkey==5
18、
19、startkey==6
20、
21、startkey==7
22、
23、startkey==8
24、
25、startkey==9){break;elseprintf(■’terror!!!inputagain:•’continue;}}pr
26、intf("初始化屮......n);fp=fopen("标记.txt",”a+");fscanf(fp,"%d",&num);fclose(fp);fp=fopen(’’password.txt","a+"fscanf(fp/'%d",&pa$s);fclose(fp);if(pass==0)fp=fopen(’’password.txt’’,nw+”fprintf(fp,H%dn,88888888);fclose(fp);}fp=fopen("记录.txt","a+’’);rewind(fp);initialize(cars,num,fp);fclose(fp)
27、;Delay(5);time_ttimer;structtm*tblock,*a;timer=time(NULL);a=localtime(&timer);while⑴{system(”cis'1);fflush(stdin);printf("所在地:%s站登录时间:。/osn,address[startkey],mytime(a));printffi1M);printf(H11•发卡1H)printff
28、2.检卡并收费1H)printf("
29、3.查询1,,)printf("
30、4.注销并退出系统1’,)printf("
31、5.退出系统1