ImageVerifierCode 换一换
格式:DOCX , 页数:22 ,大小:17.60KB ,
资源ID:8670559      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8670559.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C实习程序.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C实习程序.docx

1、C实习程序#include #include #include #include #define CLEAR system(cls)#define CONTINUE Continue()#define DATAFILE e:lib.txttypedef int Status;typedef struct Date int m_iYear; int m_iMonth; int m_iDay; Date;typedef struct TrafficPulishReceipt char m_sCarid7; char m_sDriname10; char m_sTPName10; char m_sR

2、ecnum11; Date m_CDate; struct TrafficPulishReceipt* m_pNext; *PTPR, TPR;void InitDate( Date*, int, int, int );void ShowDate( Date* );Status ComDate( Date*, Date* );PTPR CreatTPR( PTPR );void SearchByPocName( PTPR );void SearchByDriName( PTPR );void SearchByCarId( PTPR );PTPR DeleteTPR( PTPR );void S

3、tatisticsTPR( PTPR );void DestoryTPR( PTPR );PTPR InitNode( void );PTPR InsertNode( PTPR, PTPR );PTPR SearchNode_1( PTPR, char* );PTPR SearchNode_1_rf( PTPR, char* );PTPR SearchNode_2( PTPR, char* );PTPR SearchNode_3( PTPR, char* );PTPR SearchNode_4( PTPR, char* );void ShowNode( PTPR );PTPR InitTPRS

4、ystem( void );void ExitTPRSystem( PTPR );void Menu( void );void Continue( void );int CharToNum( char* );int main() PTPR pHead = NULL; char c = ; pHead = InitTPRSystem(); while( c != 0 ) CLEAR; Menu(); printf( Please input the option: ); flushall(); scanf( %c, &c ); switch( c ) case 1: pHead = CreatT

5、PR( pHead ); CONTINUE; break; case 2: SearchByDriName( pHead ); CONTINUE; break; case 3: SearchByPocName( pHead ); CONTINUE; break; case 4: SearchByCarId( pHead ); CONTINUE; break; case 5: pHead = DeleteTPR( pHead ); CONTINUE; break; case 6: StatisticsTPR( pHead ); CONTINUE; break; case 0: break; de

6、fault: printf( wrong input option!n ); CONTINUE; break; ExitTPRSystem( pHead ); return 0;void InitDate( Date* CDate, int iYear, int iMon, int iDay ) CDate-m_iYear = iYear; CDate-m_iMonth = iMon; CDate-m_iDay = iDay;void ShowDate( Date* CDate ) printf( %dyear%dmonth%dday, CDate-m_iYear, CDate-m_iMont

7、h, CDate-m_iDay );Status ComDate( Date* d1, Date* d2 ) if( d1-m_iYear m_iYear ) return -1; else if( d1-m_iYear d2-m_iYear ) return 1; else if( d1-m_iMonth m_iMonth ) return -1; else if( d1-m_iMonth d2-m_iMonth ) return 1; else if( d1-m_iDay m_iDay ) return -1; else if( d1-m_iDay d2-m_iDay ) return 1

8、; else return 0; PTPR InitNode() PTPR pTemp = ( PTPR )malloc( sizeof( TPR ) ); pTemp-m_pNext = NULL; return pTemp;PTPR InsertNode( PTPR pHead, PTPR pTemp ) PTPR p1 = pHead; PTPR p2; if( pHead ) while( p1 ) p2 = p1; if( strcmp( pTemp-m_sRecnum, p1-m_sRecnum ) m_pNext; if( p1 = pHead ) pTemp-m_pNext =

9、 pHead; pHead = pTemp; else if( !p1 ) p2-m_pNext = pTemp; else p2-m_pNext = pTemp; pTemp-m_pNext = p1; else pHead = pTemp; return pHead;PTPR SearchNode_1( PTPR pHead, char* sRecnum ) while( pHead ) if( !strcmp( pHead-m_sRecnum, sRecnum ) ) break; pHead = pHead-m_pNext; return pHead;PTPR SearchNode_1

10、_rf( PTPR pHead, char* sRecnum ) PTPR pTemp = pHead; while( pHead ) pTemp = pHead; if( !strcmp( pHead-m_sRecnum, sRecnum ) ) break; pHead = pHead-m_pNext; return pTemp;PTPR SearchNode_2( PTPR pHead, char* sDriname ) while( pHead ) if( !strcmp( pHead-m_sDriname, sDriname ) ) break; pHead = pHead-m_pN

11、ext; return pHead;PTPR SearchNode_3( PTPR pHead, char* sTPName ) while( pHead ) if( !strcmp( pHead-m_sTPName, sTPName ) ) break; pHead = pHead-m_pNext; return pHead;PTPR SearchNode_4( PTPR pHead, char* sCarid ) while( pHead ) if( !strcmp( pHead-m_sCarid, sCarid ) ) break; pHead = pHead-m_pNext; retu

12、rn pHead;void ShowNode( PTPR pTemp ) if( pTemp ) printf( Punishment odd numbers: %sn, pTemp-m_sRecnum ); printf( Vehicle trademark: %sn, pTemp-m_sCarid ); printf( Driver name: %sn, pTemp-m_sDriname ); printf( Traffic police name: %sn, pTemp-m_sTPName ); printf( Punishment date: ); ShowDate( &pTemp-m

13、_CDate ); printf( n ); void Menu() printf( Transportation punishment list management systemn ); printf( -n ); printf( 1. Founds the new punishment listn ); printf( 2. Inquires the punishment list according to the drivern ); printf( 3. Inquires the punishment list according to the traffic policen );

14、printf( 4. Inquires the punishment list according to Punishment odd numbersn ); printf( 5. Deletion punishment listn ); printf( 6. Statisticsn ); printf( 0. exitn ); printf( -n );void Continue() printf( Press any key to continue.n ); flushall(); getch();int CharToNum( char* num ) int i, index = 0; f

15、or( i = strlen( num ); i 0; i- ) index += numi - 0; index *= 10; return index /= 10;PTPR CreatTPR( PTPR pHead ) PTPR pTemp = InitNode(); int iYear, iMon, iDay; printf( Please input the related information:n ); printf( Punishment odd numbers: ); flushall(); scanf( %s, pTemp-m_sRecnum ); if( SearchNod

16、e_1( pHead, pTemp-m_sRecnum ) ) printf( The punishment odd numbers have the repetition, please reinput ); free( pTemp ); return pHead; printf( Vehicle trademark: ); flushall(); scanf( %s, pTemp-m_sCarid ); printf( Driver name: ); flushall(); scanf( %s, pTemp-m_sDriname ); printf( traffic police name

17、: ); flushall(); scanf( %s, pTemp-m_sTPName ); printf( Punishment date: ); flushall(); scanf( %d %d %d, &iYear, &iMon, &iDay ); InitDate( &pTemp-m_CDate, iYear, iMon, iDay ); return InsertNode( pHead, pTemp );void SearchByPocName( PTPR pHead ) char name10; int i = 1, check = 0; if( pHead ) printf( P

18、lease input treats inquires traffic polices name: ); flushall(); scanf( %s, name ); while( pHead ) pHead = SearchNode_3( pHead, name ); if( pHead ) check+; ShowNode( pHead ); printf(n); i+; pHead = pHead-m_pNext; if( !( i % 4 ) ) i = 0; CONTINUE; if( !check ) printf( no information!n ); else printf(

19、 Current has not punished the list! ); void SearchByDriName( PTPR pHead ) char name10; int i = 1, check = 0; if( pHead ) printf( Please input treats inquires drivers name: ); flushall(); scanf( %s, name ); while( pHead ) pHead = SearchNode_2( pHead, name ); if( pHead ) check+; ShowNode( pHead ); pri

20、ntf(n); i+; pHead = pHead-m_pNext; if( !( i % 4 ) ) i = 0; CONTINUE; if( !check ) printf( no Information!n ); else printf( Current has not punished the list! ); void SearchByCarId( PTPR pHead ) char name10; int i = 1, check = 0; if( pHead ) printf( Please input treats the inquiry vehicle trademark:

21、); flushall(); scanf( %s, name ); while( pHead ) pHead = SearchNode_4( pHead, name ); if( pHead ) check+; ShowNode( pHead ); printf(n); i+; pHead = pHead-m_pNext; if( !( i % 4 ) ) i = 0; CONTINUE; if( !check ) printf( no information!n ); else printf( Current has not punished the list! ); PTPR Delete

22、TPR( PTPR pHead ) char num11; PTPR pTemp, pT; if( pHead ) printf( Please input punishes the odd numbers: ); flushall(); scanf( %s, num ); pTemp = SearchNode_1( pHead, num ); if( pTemp ) if( pTemp = pHead ) pHead = pHead-m_pNext; else if( !pTemp-m_pNext ) pT = SearchNode_1_rf( pHead, num ); pT-m_pNex

23、t = NULL; else pT = SearchNode_1_rf( pHead, num ); pT-m_pNext = pTemp-m_pNext; free( pTemp ); printf( Deletes successfully!n ); else printf( The input number does not exist!n ); else printf( Current has not punished the list! ); return pHead;void StatisticsTPR( PTPR pHead ) Date d1, d2; char name10;

24、 int index = 0, i = 0; if( pHead ) printf( Please input the outset time: ); flushall(); scanf( %d %d %d, &d1.m_iYear, &d1.m_iMonth, &d1.m_iDay ); printf( Please input the closure time: ); flushall(); scanf( %d %d %d, &d2.m_iYear, &d2.m_iMonth, &d2.m_iDay ); if( ComDate( &d1, &d2 ) 0 ) printf( wrong

25、input!n ); else printf( Inputs the driver name: ); flushall(); scanf( %s, name ); while( pHead ) pHead = SearchNode_2( pHead, name ); if( pHead ) if( ComDate( &pHead-m_CDate, &d1 ) 0 & ComDate( &pHead-m_CDate, &d2 ) m_sRecnum ); pHead = pHead-m_pNext; if( !( index % 30 ) ) index = 0; CONTINUE; printf( Altogether %d recordn, i ); else printf( Current has not punished the list! ); void DestoryTPR( PTPR pHead ) PTPR pTemp; while( pHead ) pTemp = pHead;

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1