大佬们帮解析下为为什么出错了呢 谢谢
#include<stdio.h>enum animal {dog,cat,monkey,invalid };
void dog(void) {
puts("汪汪");
}
void cat(void){
puts("喵喵");
}
void monkey(void){
puts("叽叽");
} enum animal select(void){
int tmp;
do{
printf("0 狗 1 猫 2 猴 3 结束:");
scanf("%d",&tmp);
} while(tmp<dog||tmp>invalid);
return tmp;
}
int main (void){
enum animal selected;
do{
switch(selected=select()){
case dog:dog();break;
case cat:cat();break;
case monkey:monkey();break; }
} while(selected!=invalid);
return 0;
}
/*错误提示 3 14 C:\Users\WP-S10\Desktop\未命名2.cpp [Error] 'void dog()' redeclared as different kind of symbol
6 14 C:\Users\WP-S10\Desktop\未命名2.cpp [Error] 'void cat()' redeclared as different kind of symbol*/