F:\xhyprogram\通讯录管理.cpp(115) : fatal error C1075: end of file found before the left brace '{' at 'F:\xhyprogram\通讯录管理.cpp(73)' was matched
不怪你看不懂,应该是我自己没有把原程序发上去吧!仍然感觉你对我帖子的关注,谢谢!
谢谢你,我的程序如下,耽误你们宝贵的时间帮我看看。谢谢!!!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100
typedef struct invetory
{char name[16];
int NO;
char mobile[20];
char hometele[15];
char sex;
}INVE;
void displayMenu();
int choiceItem(void);
void input(INVE inv[],int n);
int search(INVE inv[],int n);
int DeleteRecord(INVE inv[],int
void AlterRecord(INVE inv[],int n);
main(){
INVE inv[N];
int choice;
choice=choiceItem();
do{switch(choice)
{case 1:input(inv,N);
case 2:search(inv,N);
case 3:DeleteRecord(inv,N);
case 4:AlterRecord(inv,N);
}
}while(choice!=0);
printf("\n Exit!!");
}
void displayMenu()
{printf("\n=======Menu======\n");
printf("\n1........input information\n");
printf("\n2.........search information\n");
printf("\n3.........delete information\n");
printf("\n4.........alter information\n");
printf("\n0......Exit\n");
printf("\nChoice:");
}
int choiceItem(void)
{int choice;
char line[80];
do{
displayMenu();
gets(line);
choice=atoi(line);
}while(choice<0||choice>4);
return choice;}
void input(INVE inv[],int n)
{int i;
printf("\nEnter the information:");
for(i=0;i<n;i++)
scanf("%d%s%s%s%s",&inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
printf("\n");
printf("\ndisplay input information:");
for(i=0;i<n;i++)
printf("\n%d%s%s%s%s",inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
}
int search(INVE inv[],int n)
{int key,i=0;
printf("\nEnter the search key:");
scanf("%d",&key);
if(key<0||key>n)return 0;
else {while(i<n)
{if(inv[i].NO==key)
printf("\nthe searching information is %d%s%s%s%s",inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
else i++;
}
return 1;
}
int DeleteRecord(INVE inv[],int n)
{int key,i=0,j;
printf("\nplease enter a key:");
scanf("%d",&key);
if(key<0||key>n)return error;
else{while(i<n)
{if(inv[i].NO==key)
{j=i+1;printf("the delete record is %d%s%s%s%s",inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);}
else i++;
}
n--;
printf("After deleteing dejust other records:");
for(j=i+1;i<n;j++)
{inv[j-1].NO=inv[j].NO;
inv[j-1].name=inv[j].name;
inv[j-1].mobile=inv[j].mobile;
inv[j-1].hometele=inv[j].hometele;
inv[j-1].sex=inv[j].sex;
}
printf("After dejusting the new order:");
for(i=0;i<n;i++)
printf("\nthe new order is %d%s%s%s%s\n",inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
}
void AlterRecord(INVE inv[],int n)
{int key,i=0;
printf("\n Enter a key:");
scanf("%d",&key);
if(key<0||key>n)printf("there is no this record.");
else {while(i<n)
{if(inv[i].NO==key){
printf("please dispaly the old record:");
printf("\n%d%s%s%s%s",inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
printf("\nplease input new information:");
scanf("%d%s%s%s%s",&inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
}
else i++;
}
}
printf("After alter the whole new records:");
for(i=0;i<n;i++)
printf("%d%s%s%s%s\n",inv[i].NO,inv[i].name,inv[i].mobile,inv[i].hometele,inv[i].sex);
}