我一直在用结构进行一些编码,而且我得到了一个似乎无法解决的一致错误。
我收到了这个错误。主要是1。
1>c:\users\kevin\documents\visual studio 2010\projects\is the complier trying to piss me off\is the complier trying to piss me off\lets find out.cpp(91): error C2371: 'regis' : redefinition; different basic types
1> c:\users\kevin\documents\visual studio 2010\projects\is the complier trying to piss me off\is the complier trying to piss me off\lets find out.cpp(10) : see declaration of 'regis'
这个结构
typedef struct register_
{
int cyear;// current year
int age, id, register_date, tele[15];
char choice[3], name[20], email[20], category[10];
char unique[20]; //password enter
}regis;
这是包含
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <conio.h>
void screen();
char desion(char, char);
char reg,log;
int worker_menu(char signup(struct regis));
int customer_menu(char signup(struct regis));
void in(struct enter);
char signup(struct regis);
void category(struct regis);
int time(struct register_ regis);
char add(struct movie, struct regis);
char change(struct add, struct regis, struct movie);
char today_list(struct list, struct regis, struct movie, struct add, int, int);
char bought(struct list);
void finish(struct buy, struct ticket);
int size;
float *price;
int *id,*duration;
char *unique,*code,*status,*type,*director,*ratings,*date,*title;
int rand(void);
int choice;
void main()
{
screen();
char signup(struct regis);
char desion(char, char);
while (choice !=0)
{
switch(choice)
{
case 1:
void in(struct login enter);
break;
case 2:
char signup(struct regis, struct born);
break;
case 3:
char add(struct movie, struct regis);
break;
case 4:
char change(struct add, struct regis, struct movie);
break;
case 5:
char today_list(struct list, struct regis, struct movie, struct add, int, int);
break;
case 6:
char bought(struct list);
break;
case 0:
printf("ending program\n");
default:
printf("invalid option\n");
break;
}
void screen();
}
return;
getche();
}
我不知道我做错了什么。 任何人都可以帮助
答案 0 :(得分:1)
代码有几个错误。你的问题的答案是,而不是这个:
typedef struct register_
{
...
} regis;
你应该这样写:
struct regis
{
...
};
进行此更改后,您可能会发现其他一些错误。