int Input_records(dictList,int n)这里出现error C2062: type 'int' unexpected错误,求大神教
#include<stdio.h>#include<stdlib.h>#include<ctype.h>typedefstructbookinformation{char...
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct bookinformation
{
char ISBN[10]; /*书号*/
char book[30]; /*书名*/
char author[20]; /*作者*/
int edition; /*版本号*/
char press[50]; /*出版社名*/
int year; /*出版年份*/
}Bookinfo;
Bookinfo books[100];
Bookinfo dictList[100];
int menu_select()
{
char c;
do{
system("cls");
printf("1.Input records");
printf("2.Display All Records");
printf("3.Delect a Record");
printf("4.Sort");
printf("5.Insert a Record");
printf("6.Query");
printf("7.Add Records from a Text File");
printf("8.Write to a Text File");
printf("0.Quit");
printf("Give your choice:");
c=getchar();
}while(c<'0' || c>'8');
return(c-'0');
}
int Input_records(dictList,int n)
{
int i;
char c[1]={'y'};
printf("请依次输入书号,书名,作者,版本号,出版社名,出版年份");
for(i=0;c='y';i++)
{
gets(dictList[i].ISBN);
gets(dictList[i].book);
gets(dictList[i].author);
scanf("%d",&dictList[i].edition);
gets(dictList[i].press);
scanf("%d",&dictList[i].year");
printf("%s\t%s\t%s\t%d\t%s\t%d\t\n",dictList[i].ISBN,dictList[i].book,dictList[i].author,dictList[i].edition,dictList[i].press,dictList[i].year);
printf("是否继续(y/n)");
gets(c);
}
for(i=0;books[i].ISBN!='\0';i++)
n+=1;
return n;
}
main()
{
int n=0,i=0;
for(;;)
{
switch(menu_select())
{
case 1:Input(books,n); break;
}
}
return 0;
} 展开
#include <stdlib.h>
#include <ctype.h>
typedef struct bookinformation
{
char ISBN[10]; /*书号*/
char book[30]; /*书名*/
char author[20]; /*作者*/
int edition; /*版本号*/
char press[50]; /*出版社名*/
int year; /*出版年份*/
}Bookinfo;
Bookinfo books[100];
Bookinfo dictList[100];
int menu_select()
{
char c;
do{
system("cls");
printf("1.Input records");
printf("2.Display All Records");
printf("3.Delect a Record");
printf("4.Sort");
printf("5.Insert a Record");
printf("6.Query");
printf("7.Add Records from a Text File");
printf("8.Write to a Text File");
printf("0.Quit");
printf("Give your choice:");
c=getchar();
}while(c<'0' || c>'8');
return(c-'0');
}
int Input_records(dictList,int n)
{
int i;
char c[1]={'y'};
printf("请依次输入书号,书名,作者,版本号,出版社名,出版年份");
for(i=0;c='y';i++)
{
gets(dictList[i].ISBN);
gets(dictList[i].book);
gets(dictList[i].author);
scanf("%d",&dictList[i].edition);
gets(dictList[i].press);
scanf("%d",&dictList[i].year");
printf("%s\t%s\t%s\t%d\t%s\t%d\t\n",dictList[i].ISBN,dictList[i].book,dictList[i].author,dictList[i].edition,dictList[i].press,dictList[i].year);
printf("是否继续(y/n)");
gets(c);
}
for(i=0;books[i].ISBN!='\0';i++)
n+=1;
return n;
}
main()
{
int n=0,i=0;
for(;;)
{
switch(menu_select())
{
case 1:Input(books,n); break;
}
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询