本程序用C寫成,鼓勵批評指正!
Name:Contact++
Version:0.2
Powered By GenialX
From 沈陽化工大學2011級
URL:胡旭-煦生活 - 胡旭個人博客 - 一個自由大學生的瑣碎
QQ:2252065614
QQ交流群:235173087(歡迎加入,增增人氣兒...)
---2013.02.07
基本功能實現:
通訊錄信息插入、刪除、編輯、查找、修改以及信息存盤(contact.ctt)。
實現原理:
利用指針操作鏈表實現通訊錄功能。
記錄:
添加給存盤文檔加密的功能(存檔文件即根目錄下的contact.ctt文件)
詳細:利用異或加密,由於異或操作的特性,所以加密和解密調用,同一個實現即可。
步驟:
1、定義密鑰常量KEY(默認值為'x')。
2、修改getInfo()函數。首先創建一個臨時文件tmp.ctt(屬性設置成系統隱藏文件),然後把源文件(加密文件)讀取,並將解密後的內容放入tmp.ctt中。然後將tmp.ctt中的內容逐步讀入鏈表,之後刪除臨時文件tmp.ctt。
3、修改saveRecords()函數。原理基本同上,創建系統隱藏文件作為臨時緩沖文件(tmp.ctt),之後刪除。
---2013.02.07 21:01
定義常量
詳細:將一些信息定一場全局常量,便於管理。比如:作者信息。
---2013.02.08 08:26
源碼:
#include <stdio.h> #include <stdlib.h> #include <.h> #include <windows.h> C_NAME_SIZE 10 C_SEX_SIZE 3 C_AGE_SIZE 5 C_PHONE_SIZE 12 C_QQ_SIZE 12 C_PROVINCE_SIZE 20 C_CITY_SIZE 20 C_COMMENT_SIZE 100 insRecord(); inputs( *prompt, *info, count); addr *linkNode( addr *i, addr *top); addr *find( *name); seaRecord(); delRecord(); selectMenu(); disRecord(addr *info); disRecords(); getInfo(); initInputs( *initInfo[]); saveRecords(); saveToFile(addr *info); editRecord(); about(); c_phone[ addr *next; addr *info,*start,*last,* n = KEY= AUTHOR[] = VERSION[] = DESC[] = QQ[] = URL[] = FROM[] = TIME[] = APPNAME[] = s[ printf();Sleep( printf();Sleep( printf();Sleep( printf();Sleep( printf();Sleep( printf();Sleep( printf();Sleep( printf();Sleep( printf( c = atoi(s); }(c<||c> addr *info; (;;n++ info = ( addr *)malloc(( (info == printf( ; printf( inputs(,info-> (info->c_name[] == printf( } inputs(,info-> inputs(,info-> inputs(,info-> inputs(,info-> inputs(,info-> inputs(,info-> inputs(,info-> start = linkNode(info,start); (n == head = start; inputs( *prompt, *info, p[ printf( (strlen(p)/> printf( }(strlen(p)/> strcpy(info,p); addr *linkNode( addr *current, addr * (! last = current->next = top->next= current->next= last = addr * addr * info = str[ printf();Sleep( printf( scanf(,& printf( (!strcmp(str,info-> info = info-> (info = }; (!strcmp(str,info-> info = info-> (info = }; (!strcmp(str,info-> info = info-> (info = }; (!strcmp(str,info-> info = info-> (info = }; (!strcmp(str,info-> info = info-> (info = }; :(info = NULL); addr * info = printf();Sleep( (info == NULL) printf( Sleep( disRecord(addr * printf(,info->c_name);Sleep( printf(,info->c_sex);Sleep( printf(,info->c_age);Sleep( printf(,info->c_phone);Sleep( printf(,info->c_qq);Sleep( printf(,info->c_province);Sleep( printf(,info->c_city);Sleep( printf(,info-> Sleep( addr *info = (info == printf( info = info-> addr *p1,*p2,* info = printf( Sleep( (info != (head == head = info-> printf(,info-> Sleep( p1 = head-> p2 = (info != p2 = p1 = p1-> p2->next = p1-> printf(,info-> Sleep( printf( Sleep( FILE *fp,* *info[ str[ m = ; printf( ( i = ; i<;i++ info[i] = ( *)malloc( ()* ((sfp = fopen(,)) == printf( ((fp = fopen(,)) != system( ch = fgetc(sfp); (!feof(sfp)){ fputc(ch^ ch = rewind(fp); } printf( Sleep( printf( ( (ch = fgetc(fp)) != (ch == ) i = ( (ch = fgetc(fp)) != EOF && ch != str[i] = i++ str[i] = (m == ) strcpy(info[m++ m = ; strcpy(info[m++ str[] = Sleep( printf( Sleep( system( initInputs( * addr *info; (;;n++ info = ( addr *)malloc(( (info == printf( ; strcpy(info->c_name,initInfo[ strcpy(info->c_sex,initInfo[ strcpy(info->c_age,initInfo[ strcpy(info->c_phone,initInfo[ strcpy(info->c_qq,initInfo[ strcpy(info->c_province,initInfo[ strcpy(info->c_city,initInfo[ strcpy(info->c_comment,initInfo[ start = linkNode(info,start); (n == head = start; n++ flag= addr *p1,* FILE *fp,* printf( flag = (flag == || flag == ) (head != p1 = Sleep( printf( Sleep( p2 = p1 = p1-> free(p2); }(p1 != fp = fopen(, ( (tmpFp = fopen(,)) != ch = (! fputc(ch^ ch = } printf( system( head = start = last = printf( Sleep( printf( Sleep( { Sleep( printf( Sleep( printf( Sleep( saveToFile(addr * FILE * ( ( fp = fopen(,) ) != system( fprintf(fp,,info-> fprintf(fp,,info-> fprintf(fp,,info-> fprintf(fp,,info-> fprintf(fp,,info-> fprintf(fp,,info-> fprintf(fp,,info-> fprintf(fp,,info-> fclose(fp); printf( Sleep( Sleep( printf(,DESC);Sleep( printf(,APPNAME);Sleep( printf(,VERSION);Sleep( printf(,AUTHOR);Sleep( printf(,FROM);Sleep( printf(,URL);Sleep( printf(,QQ);Sleep( printf( Sleep( addr * info = printf();Sleep( (info != printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( puts(info-> printf( gets(info-> printf( :insRecord(); :delRecord(); :seaRecord(); :editRecord(); :printf();Sleep();disRecords(); :about(); :saveRecords();exit( } }
Its Done~