急求一份c语言课程设计 通信录管理系统的程序!!

主要功能:

1能建立修改和增删学生通信录

2能够按多种方式进行查询

要求:界面友好,易于操作

(请各位大虾提供能运行的有用程序,O(∩_∩)O谢谢!)

第1个回答  推荐于2016-12-03
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>

struct contacks
{ char name[10];
char mobile[10];
char fixtelephone[10];
char Email[20];
char street[20];
}con[50];
int k=0;

void enter();
void display();
void lookandchange();
void del();
void save();

void main()
{
int a;
do
{

printf("\n\n ******************************************************************\n");
printf(" *"); printf("\t\twelcome enter the contacks system"); printf("\t\t*");
printf("\n ******************************************************************\n");

printf(" *"); printf("\t 1.Access information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 2.display information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 3.lookandchange information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 4.Delete information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 5.Save the information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 6. exit "); printf("\t\t\t\t\t*\n");
printf(" ******************************************************************\n");

printf(" Enter you choice : ");
scanf("%d",&a);

switch(a)
{

case 1:printf("\n");enter();break;
case 2:printf("\n");display();break;
case 3:printf("\n");lookandchange();break;
case 4:printf("\n");del();break;
case 5:printf("\n");save();break;
case 6:printf("\n");exit(0);break;
default:printf("\nThe choice is between 1 to 6.\n");
}
}while(a!=0);

}

void enter()
{
char ch[20];

printf("\nenter student information:\n");
do
{ printf("\nname: ");
scanf("%s",con[k].name);
printf("mobile: ");
scanf("%s",con[k].mobile);
printf("\nfixtelephone: ");
scanf("%s",con[k].fixtelephone);
printf("\nEmail: ");
scanf("%s",con[k].Email);
printf("\nstreet: ");
scanf("%s",con[k].street);
k++;
printf("\nif want continue input student information(y/n): ");
scanf("%s",ch);
}while(strcmp(ch,"y")==0||strcmp(ch,"Y")==0);
display();
}

void display()
{ int i;
printf(" the information is:\n");
for(i=0;i<k;i++)
{ printf("%10s %20s %10s %10s %10s ",con[i].name,con[i].mobile,con[i].fixtelephone,con[i].Email,con[i].street);
printf("\n"); }
}

void lookandchange()

{
int i;
char a[20],ch[10];
printf("\nenter you want look name:");
scanf("%s",a);
for(i=0;i<k;i++)
if(strcmp(con[i].name,a)==0) printf("%10s %20s %10s %10s %10s ",con[i].name,con[i].mobile,con[i].fixtelephone,con[i].Email,con[i].street);
printf("\nyou sure want change student y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0)
{ printf("\nenter you want change name:");
scanf("%s",a);
for(i=0;i<k;i++)
{
if(strcmp(con[i].name,a)==0)
{ printf("\nyou sure want change student name(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nname:"); scanf("%s",con[i].name);}
printf("\nyou sure want change mobile(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nmobile"); scanf("%s",con[i].mobile);}
printf("\nyou sure want change fixtelephone(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nfixtelephone"); scanf("%s",con[i].fixtelephone);}
printf("\nyou sure want change Email(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nEmail"); scanf("%s",con[i].Email);}
printf("\nyou sure want changestreet(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstreet"); scanf("%s",con[i].street);}
}
} }
display();
}

void del()
{
int i,j;
char c[20];
printf("\nenter you want delete name :\n");
printf("name:");
scanf("%s",&c);
for(i=0;i<k;i++)
if(strcmp(c,con[i].name)==0) break;
for(j=i;j<=2;j++)
con[j]=con[j+1];
printf("\t\t\tyou had delete %s\n",c);
k--;
display();
}

void save()
{ FILE *fp; int i;
if((fp=fopen("xinxi.txt","w"))==NULL)
{ printf("cannot write the file.\n");
exit(0);}
for(i=0;strlen(con[i].name)!=0;i++)
fprintf(fp,"%s %s %s %s %s\n",con[i].name,con[i].mobile,con[i].fixtelephone,con[i].Email,con[i].street);
fclose(fp);
}

这个是以前编的一个 在vc++中编译成功 你自己可以根据需要来改 应该可以满足你的要求本回答被提问者采纳
相似回答