⑴ c語言製作簡單的通訊錄
主要是鏈表的操作,直接定義個結構體和指針的運用。
⑵ C語言通訊錄
自己網路去搜索。然後自己去分析!
⑶ c語言通訊錄編寫
靠山山倒,靠樹樹倒,靠自己最好!
自己寫吧,一個
結構體{
姓名;
性別;
年齡;
手機;
}
如果不會用鏈表,那你就用數組!
錄入:就是往數組里寫入數據
刪除:就清為0就可以了唄
查詢:就是從數組的第一項到保存數查找一遍嘍。
大哥
,你是在做課程設計吧?計科的?
傷不起!!!!!!
⑷ 用C語言和鏈表設計電子通訊錄
可聯系,看ID
⑸ C語言 通訊錄
你個沒出息的東西,你父母花了那麼多錢供你上學,你看看你,都學了點什麼!還來網上找人做作業!
⑹ c語言學生通訊錄管理系統
/* HELLO.C -- Hello, world */
#include<stdio.h>
struct person
{
char name[8];
char tel[15];
char addr[50];
};
char filename[20]="E:\\txl.txt";
FILE *fp;
void creat();
void output();
void search();
void append();
void modify();
void delete();
main( )
{
int m;
creat();
while(1)
{
printf("\n\t\t*********歡迎使用通訊錄信息管理系統*********\n\n");
printf("\n\t\t添加,請按1");
printf("\n\t\t查找,請按2");
printf("\n\t\t修改,請按3");
printf("\n\t\t刪除,請按4");
printf("\n\t\t輸出,請按5");
printf("\n\t\t退出,請按0\n");
printf("\n\t\t********************************************\n\n");
printf("Please select(0--5):");
scanf("%d",&m);
if(m>=0&&m<=5)
{
switch(m)
{
case 1: append();
break;
case 2: search();
break;
case 3: modify();
break;
case 4: delete();
break;
case 5: output();
break;
case 0: exit();
}
printf("\n\n操作完畢,請再次選擇!");
}
else
printf("\n\n選擇錯誤,請再次選擇!");
}
}
/*輸入模塊creat( ): 創建通訊錄的子函數。*/
void creat()
{
struct person one;
long s1;
/*printf("\n請輸入通訊錄文件名:");
scanf("%s",filename); */
if((fp=fopen(filename,"at+"))==NULL)
{
printf("\n不能建立通訊錄!");
exit();
}
fprintf(fp,"%-10s%-20s%-50s\n","姓名","電話號碼","住址");
printf("\n請輸入姓名、電話號碼及住址(以0結束)\n");
scanf("%s",one.name);
while(strcmp(one.name,"0"))
{
scanf("%s%s",one.tel,one.addr);
fprintf(fp,"%-10s%-20s%-50s\n",one.name,one.tel,one.addr);
scanf("%s",one.name);
}
fclose(fp);
}
/*輸出模塊output( ):輸出通訊錄中聯系人通訊信息的子函數*/
void output()
{
struct person one;
if((fp=fopen(filename,"r"))==NULL)
{
printf("\n不能打開通訊錄!");
exit();
}
printf("\n\n%20s\n","通 訊 錄");
while(!feof(fp))
{
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
printf("%-10s%-20s%-50s",one.name,one.tel,one.addr);
}
fclose(fp);
}
/*添加模塊append( ):向通訊錄中添加某人通訊信息的子函數*/
void append()
{
struct person one;
if((fp=fopen(filename,"a"))==NULL)
{
printf("\n不能打開通訊錄!");
exit();
}
printf("\n請輸入添加的姓名、電話號碼及住址\n");
scanf("%s%s%s",one.name,one.tel,one.addr);
fprintf(fp,"%-10s%-20s%-50s\n",one.name,one.tel,one.addr);
fclose(fp);
}
/*查找模塊search( ):在通訊錄中查找某人通訊信息的子函數*/
void search()
{
int k=0;
char namekey[8];
struct person one;
printf("\n請輸入姓名:");
scanf("%s",namekey);
if((fp=fopen(filename,"rb"))==NULL)
{
printf("\n不能打開通訊錄!");
exit();
}
while(!feof(fp))
{
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
if(!strcmp(namekey,one.name))
{
printf("\n\n已查到,記錄為:");
printf("\n%-10s%-18s%-50s",one.name,one.tel,one.addr);
k=1;
}
}
if(!k)
printf("\n\n對不起,通訊簿中沒有此人的記錄。");
fclose(fp);
}
/*修改模塊modify( ):在通訊錄中修改某人通訊信息的子函數*/
void modify()
{
int m,k=0;
long offset;
char namekey[8];
struct person one;
printf("\n請輸入姓名:");
scanf("%s",namekey);
if((fp=fopen(filename,"r+"))==NULL)
{
printf("\n不能打開通訊錄!");
exit();
}
while(!feof(fp))
{
offset=ftell(fp);
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
if(!strcmp(namekey,one.name))
{
k=1;
break;
}
}
if(k)
{
printf("\n已查到,記錄為:");
printf("\n%-10s%-18s%-50s",one.name,one.tel,one.addr);
printf("\n請輸入新姓名、電話號碼及住址:");
scanf("%s%s%s",one.name,one.tel,one.addr);
fseek(fp,offset,SEEK_SET);
printf("%ld",ftell(fp));
fprintf(fp,"%-10s%-20s%-50s\n",one.name,one.tel,one.addr);
}
else
printf("\n對不起,通訊錄中沒有此人的記錄。");
fclose(fp);
}
/*刪除模塊delete( ):在通訊錄中刪除某人通訊信息的子函數*/
void delete()
{
int m,k=0,flag;
long offset1,offset2;
char namekey[8], valid[4];
struct person one;
printf("\n請輸入姓名:");
scanf("%s",namekey);
if((fp=fopen(filename,"r+"))==NULL)
{
printf("\n不能打開通訊錄!");
exit();
}
while(!feof(fp))
{
offset1=ftell(fp);
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
if(!strcmp(namekey,one.name))
{
k=1;
break;
if(k)
{
printf("\n已查到,記錄為");
printf("\n%-10s%-18s%-50s",one.name,one.tel,one.addr);
printf("\n確實要刪除,按1;不刪除,按0:");
scanf("%d",&m);
if(m)
{
fseek(fp,offset1,SEEK_SET);
fprintf(fp,"%-10s%-20s%-50s\n","","","");
}
else
printf("\n對不起,通訊錄中沒有此人的記錄。");
fclose(fp);
}
}
}
}
<PIXTEL_MMI_EBOOK_2005>1###########################################################</PIXTEL_MMI_EBOOK_2005>
⑺ C語言通訊錄。。
分組信息可以作為聯系人的一個屬性,簡單些弄一個大數組存放聯系人信息。
⑻ c語言通訊錄
請問對於剛才我的回答有疑問嗎?
已經完成了顯示全部已輸入信息
刪除聯系人看你想用哪種形式了
⑼ c語言編寫通信錄
/*編程建立一通訊簿,存放有姓名、電話號碼、住址,然後對通信簿進行查找、添加、修改及刪除。*/
#include<stdio.h>
struct person
{
char name[8];
char tel[15];
char addr[50];
};
char filename[20];
FILE *fp;
void creat();
void output();
void search();
void append();
void modify();
void delete();
main()
{
int m;
creat();
while(1)
{
printf("\n\n添加,請按1");
printf("\n查找,請按2");
printf("\n修改,請按3");
printf("\n刪除,請按4");
printf("\n輸出,請按5");
printf("\n退出,請按0\n");
scanf("%d",&m);
if(m>=0&&m<=5)
{
switch(m)
{
case 1: append();
break;
case 2: search();
break;
case 3: modify();
break;
case 4: delete();
break;
case 5: output();
break;
case 0: exit();
}
printf("\n\n操作完畢,請再次選擇!");
}
else
printf("\n\n選擇錯誤,請再次選擇!");
}
}
void creat()
{
struct person one;
long s1;
printf("\n請輸入通訊簿名:");
scanf("%s",filename);
if((fp=fopen(filename,"w"))==NULL)
{
printf("\n不能建立通訊簿!");
exit();
}
fprintf(fp,"%-10s%-20s%-50s\n","姓名","電話號碼","住址");
printf("\n請輸入姓名、電話號碼及住址(以0結束)\n");
scanf("%s",one.name);
while(strcmp(one.name,"0"))
{
scanf("%s%s",one.tel,one.addr);
fprintf(fp,"%-10s%-20s%-50s\n",one.name,one.tel,one.addr);
scanf("%s",one.name);
}
fclose(fp);
}
void output()
{
struct person one;
if((fp=fopen(filename,"r"))==NULL)
{
printf("\n不能打開通訊簿!");
exit();
}
printf("\n\n%20s\n","通 訊 簿");
while(!feof(fp))
{
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
printf("%-10s%-20s%-50s",one.name,one.tel,one.addr);
}
fclose(fp);
}
void append()
{
struct person one;
if((fp=fopen(filename,"a"))==NULL)
{
printf("\n不能打開通訊簿!");
exit();
}
printf("\n請輸入添加的姓名、電話號碼及住址\n");
scanf("%s%s%s",one.name,one.tel,one.addr);
fprintf(fp,"%-10s%-20s%-50s\n",one.name,one.tel,one.addr);
fclose(fp);
}
void search()
{
int k=0;
char namekey[8];
struct person one;
printf("\n請輸入姓名:");
scanf("%s",namekey);
if((fp=fopen(filename,"rb"))==NULL)
{
printf("\n不能打開通訊簿!");
exit();
}
while(!feof(fp))
{
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
if(!strcmp(namekey,one.name))
{
printf("\n\n已查到,記錄為:");
printf("\n%-10s%-18s%-50s",one.name,one.tel,one.addr);
k=1;
}
}
if(!k)
printf("\n\n對不起,通訊簿中沒有此人的記錄。");
fclose(fp);
}
void modify()
{
int m,k=0;
long offset;
char namekey[8];
struct person one;
printf("\n請輸入姓名:");
scanf("%s",namekey);
if((fp=fopen(filename,"r+"))==NULL)
{
printf("\n不能打開通訊簿!");
exit();
}
while(!feof(fp))
{
offset=ftell(fp);
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
if(!strcmp(namekey,one.name))
{
k=1;
break;
}
}
if(k)
{
printf("\n已查到,記錄為:");
printf("\n%-10s%-18s%-50s",one.name,one.tel,one.addr);
printf("\n請輸入新姓名、電話號碼及住址:");
scanf("%s%s%s",one.name,one.tel,one.addr);
fseek(fp,offset,SEEK_SET);
printf("%ld",ftell(fp));
fprintf(fp,"%-10s%-20s%-50s\n",one.name,one.tel,one.addr);
}
else
printf("\n對不起,通訊簿中沒有此人的記錄。");
fclose(fp);
}
void delete()
{
int m,k=0,flag;
long offset1,offset2;
char namekey[8], valid[4];
struct person one;
printf("\n請輸入姓名:");
scanf("%s",namekey);
if((fp=fopen(filename,"r+"))==NULL)
{
printf("\n不能打開通訊簿!");
exit();
}
while(!feof(fp))
{
offset1=ftell(fp);
fscanf(fp,"%s%s%s\n",one.name,one.tel,one.addr);
if(!strcmp(namekey,one.name))
{
k=1;
break;
}
}
if(k)
{
printf("\n已查到,記錄為");
printf("\n%-10s%-18s%-50s",one.name,one.tel,one.addr);
printf("\n確實要刪除,按1;不刪除,按0:");
scanf("%d",&m);
if(m)
{
fseek(fp,offset1,SEEK_SET);
fprintf(fp,"%-10s%-20s%-50s\n","","","");
}
}
else
printf("\n對不起,通訊簿中沒有此人的記錄。");
fclose(fp);
}
⑽ c語言編程 通訊錄
拿取到的值去資料庫遍歷一遍。把數據相同的列出來就可以了。