我刚刚做课程设计的一小部分。特别不明白应该怎么改正?
#include<stdio.h>#include<string.h>
#include<stdlib.h>
struct student
{
char name[10];
char sex;
long int phone;
char adress[20];
long int QQ;
};
int main()
{
FILE*fp;
int i;
int Creat(int num);
int count=6;
struct student stu[20]={{"Lily",'W',111123,"apple road",56443256},
{"Bob",'M',656411,"banaba road",83254467},
{"Tom",'M',897523,"tower road",564432123},
{"Kity",'W',495821,"rain road",56458369},
{"Tony",'M',367498,"gold road",564454781},
{"Sed",'M',232599,"air road",294658715}};
fp=fopen("D:\\stu.txt","wb");
for(i=0;i<6;i++)
fprintf(fp,"%s\t %c\t %ld\t %s\t %ld",stu[i].name,stu[i].sex,stu[i].phone,stu[i].adress,stu[i].QQ);
fclose(fp);
int n;
printf(">>>>>>>>>>>>>>>>>欢迎使用通讯录系统<<<<<<<<<<<<<<<<<<\n*******************************************************\n");
printf("\n1--------------------添加");
printf("\n2--------------------修改");
printf("\n3--------------------删除");
printf("\n4--------------------查找");
printf("\n0--------------------结束");
printf("请选择功能编号:");
scanf("%d",&n);
switch(n)
{
case 1:i=Creat(i);break;
case 2:Update;break;
case 3:break;
case 4:break;
case 0:return 0;
default:printf("输入错误!");break;
}
int Creat(int num)
{
FILE*fp
int j=num+1;
printf("请输入姓名(英文):");
scanf("%s",stu[j].name);
printf("请输入性别(m男,w女):");
scanf("%c",stu[j].sex);
printf("请输入电话:");
scanf("%ld",stu[j].phone);
printf("请输入地址(英文):");
scanf("%s",stu[j].adress);
printf("请输入QQ号:");
scanf("%ld",stu[j].QQ);
num++;
fp=fopen("D:\\stu.txt","wb");
for(i=0;i<num;i++)
fprintf(fp,"%s\t %c\t %ld\t %s\t %ld",stu[j].name,stu[j].sex,stu[j].phone,stu[j].adress,stu[j].QQ);
fclose(fp);
for (j=0;j<num;j++)
printf("%d\t %s\t %c\t %5d\t %s\t %5d\n",stu[i].count,stu[i].name,stu[i].sex,stu[i].phone,stu[i].adress,stu[i].QQ);
return(i);
}
新建文件夹 (9)\课程设计.cpp(48) : error C2601: 'Creat' : local function definitions are illegal