出了点错 求帮助
#include<stdio.h>#include<string.h>
#include<stdlib.h>
#define maxsize 100
int b=0;
typedef struct
{
char name[10];
long number;
char sex[3];
char addrss[maxsize];
int group;
}contact;
int insert(contact *L)
{
system("cls");
FILE *p;
static int a=0;
if(a=0)
p=fopen("tel.txt","w+");
else
p=fopen("tel.txt","a");
printf("输入姓名:");
scanf("%s",L->name);
printf("输入号码:");
scanf("%ld",&L->number);
printf("输入性别:");
scanf("%s",L->sex);
printf("选择群组:0-不分组,1-同学,2-同事,3-亲友。");
scanf("%d",&L->group);
printf("输入联系人地址:");
scanf("%s",L->addrss);
fprintf(p,"姓名:%s\n",L->name);
fprintf(p,"性别:%s\n",L->sex);
fprintf(p,"号码:%ld\n",L->number);
fprintf(p,"组号:%d\n",L->group);
fprintf(p,"地址:%s\n\n",L->addrss);
fclose(p);
a++;
}
int get(contact *L)
{
system("cls");
int x,i;
printf("分组显示群组:0-不分组,1-分组\n");
scanf("%d",x);
if(x==0)
for(i=0;i<b;i++)
if(L[i].group==0)
{printf("姓名:%s\n",L[i].name);
printf("性别:%s\n",L[i].sex);
printf("号码:%ld\n",L[i].number);
printf("地址:%s\n\n",L[i].addrss);
}
}
int serch()
{
}
int face()
{
printf("\t\t 手机通讯录\n");
printf("\t*************************************\n");
printf("\t\t1. 创建通讯录\n");
printf("\t\t2. 添加个人信息\n");
printf("\t\t3. 查找个人信息\n");
printf("\t\t4. 显示通讯录\n");
printf("\t\t5. 修改通讯录\n");
printf("\t\t6. 退出系统\n");
printf("\t*************************************\n");
printf("\t请选择需要处理的功能:");
}
int main()
{
contact people[maxsize];
int x;
face();
scanf("%d",&x);
switch(x)
{
case 1: break;
case 2:{insert(&people[b]);b++;return main();}
case 3: break;
case 4:{get(people);return main();}
case 5: break;
case 6: break;
default :{system("cls");printf("\t\t选择错误,请重新选择!\n");return main();}
}
}
这是通讯录 我用get函数输出的不是输入的结果 不知道错在哪里 求帮助!