Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 重新定义;不同的基本类型_C_Types_Basic_Redefinition - Fatal编程技术网

C 重新定义;不同的基本类型

C 重新定义;不同的基本类型,c,types,basic,redefinition,C,Types,Basic,Redefinition,我一直在用结构做一些编码,我得到了一个似乎没有人能解决的一致性错误 我得到了这个错误,主要是第一行 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; differ

我一直在用结构做一些编码,我得到了一个似乎没有人能解决的一致性错误

我得到了这个错误,主要是第一行

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();
}
#包括
#包括
#包括
#包括
#包括
空屏();
字符设计(字符,字符);
char-reg,log;
int worker_菜单(字符注册(struct regis));
int customer_菜单(char注册(struct regis));
在中无效(结构输入);
字符注册(structregis);
无效类别(结构区域);
int时间(结构寄存器\寄存器);
char add(struct电影、struct regis);
字符更改(结构添加、结构注册、结构电影);
今日字符列表(结构列表、结构注册表、结构电影、结构添加、int、int);
char(结构列表);
作废完成(结构购买、结构票);
整数大小;
浮动*价格;
int*id,*持续时间;
字符*唯一、*代码、*状态、*类型、*主管、*评级、*日期、*标题;
国际兰特(作废);
智力选择;
void main()
{
屏幕();
字符注册(structregis);
字符设计(字符,字符);
while(选项!=0)
{
开关(选择)
{ 
案例1:
在中无效(结构登录输入);
打破
案例2:
char注册(struct regis,struct born);
打破
案例3:
char add(struct电影、struct regis);
打破
案例4:
字符更改(结构添加、结构注册、结构电影);
打破
案例5:
今日字符列表(结构列表、结构注册表、结构电影、结构添加、int、int);
打破
案例6:
char(结构列表);
打破
案例0:
printf(“结束程序”\n);
违约:
printf(“无效选项”);
打破
}
空屏();
}
回来
getche();
}
我不知道我做错了什么。
有人能帮忙吗?代码有几个错误。你的问题的答案不是这样的:

typedef struct register_
{
    ...
} regis;
你应该这样写:

struct regis
{
    ...
};

在进行此更改后,您可能会发现其他错误。

请不要使用C++代码片段——它只适用于Web技术。谢谢。这是一种非常类似C的样式,看起来不像C++。如果此示例来自一本书或一个网站,您应该寻找一个更为最新的资源来学习。您在
main
中声明了很多函数,但您只调用了三个函数,其中一个是在返回后调用的。你应该重读你那本好书中关于函数的章节。在你尝试编译之前,你不应该写太多的代码。阅读错误消息,编译器会告诉你问题出在哪一行的哪一个文件上。谢谢,我现在知道我的结构哪里错了。