c语言,总是有[Error] request for member 'name' in 'inf', which is of non-class type 'inf [10]'……类的错误,是哪里写错了?
#include<stdio.h>
#include<malloc.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
struct inf
{
char rate[20];
char name[20];
int time_hour;
int time_min;
int seat_amount;
int sell_amount;
}inf[10];
char n[20];
int p;
struct tm*ptr;
void menu()//主菜单函数
{
printf("***********menu************\n");
printf(" 1 买票\n\r");
printf(" 2 退票\n\r");
printf(" 3 满座率\n\r");
printf(" 4 退出\n\r");
printf("***************************\n");
}
void read()//输入信息函数
{
int i,re;
FILE *fp;
fp=fopen("movie_details.txt","r");
if(fp==NULL)
{
printf("文件打开失败");
exit(0);
}
for(i=0;;++i)
{
re=fscanf(fp,"%s %s %d %d %d %d\n",inf[i].rate,inf[i].name,&inf[i].time_hour,&inf[i].time_min,&inf[i].sell_amount,&inf[i].seat_amount);
if(re==EOF)
break;
}
p=i;
for(i=0;i<10;++i)
{
if(inf[i].rate=='\0')
break;
}
printf("读取成功\n");
fclose(fp);
}
void remain()//信息保存
{
int i;
FILE *fp;
fp=fopen("","w");
if(fp==NULL)
printf("文件打开失败");
exit(0);
for(i=0;i<p;++i)
{
fprintf(fp,"%s %s %d %d %d %d\n",inf[i].rate,inf[i].name,&inf[i].time_hour,&inf[i].time_min,&inf[i].sell_amount,&inf.seat_amount);
}
printf("数据保存成功");
fclose(fp);
}
void time()
{
time_t it;
it=time(NULL);
ptr=localtime(&it);
printf("现在的时间是%4d年%2d月%2d日%d:%d:%d\n",ptr->tm_year+1900,ptr->tm_mon+1,ptr->tm_mday,ptr->tm_hour,ptr->tm_min,ptr->tm_sec);
}
int minate(int q,int p)//将时间转化为分钟
{
int time_sum;
time_sum=60*q+p;
return time_sum;
}
void buy_ticket()
{
int i,a;
char s[20];
printf("请输入你想要观看的电影:\n");
printf("请输入您想观看的电影名称");
scanf("%s",s);
for(i=0;i<p;++i)
{
if(strcmp(inf.name,s)==0)
{
printf("你想看的电影信息如下:\n");
printf("%s%s %d:%d %d%d\n",inf[i].name,inf[i].rate,&inf[10].time_hour,&inf[i].time_min,&inf[i].sell_amount,&inf[i].seat_amount);
}
if(minate(inf[i].time_hour,inf[i].time_min)>minate(ptr->tm_hour,ptr->tm_min))
{
printf("请输入您的购买票数:");
scanf("%d",&a);
inf[i].seat_amount-=a;
inf[i].sell_amount+=a;
}