C++fatal error LNK1561: 必须定义入口点
#include<iostream>usingnamespacestd;voidmian(){intmonth;intday;charretry;do{cout<<"请输...
#include<iostream>
using namespace std;
void mian()
{ int month;
int day;
char retry;
do
{ cout<<"请输入您的出生月份\n";
cin>>month;
cout<<"请问您出生于"<<month<<"几号?\n";
cin>>day;
if ((day>31)||(month>12)||((month=2)&&(day>29))||(((month=4)||(month=6)||(month=9)||(month=11))&&(day>30)))
cout<<"您输入的是错误的日期\n";
else if(((month==3)&&(21<=day)&&(day<=31))||((month==4)&&(1<=day)&&(day<=19)))
cout<<"您的星座为白羊座,属性火\n";
else if(((month==4)&&(20<=day)&&(day<=30))||((month==5)&&(1<=day)&&(day<=20)))
cout<<"您的星座为金牛座,属性土\n";
else if(((month==5)&&(21<=day)&&(day<=31))||((month==6)&&(1<=day)&&(day<=21)))
cout<<"您的星座为双子座,属性气\n";
else if(((month==6)&&(22<=day)&&(day<=30))||((month==7)&&(1<=day)&&(day<=22)))
cout<<"您的星座为巨蟹座,属性水\n";
else if(((month==7)&&(23<=day)&&(day<=31))||((month==8)&&(1<=day)&&(day<=22)))
cout<<"您的星座为狮子座,属性火\n";
else if(((month==8)&&(23<=day)&&(day<=31))||((month==9)&&(1<=day)&&(day<=22)))
cout<<"您的星座为处女座,属性土\n";
else if(((month==9)&&(23<=day)&&(day<=30))||((month==10)&&(1<=day)&&(day<=22)))
cout<<"您的星座为天平座,属性气\n";
else if(((month==10)&&(23<=day)&&(day<=31))||((month==11)&&(1<=day)&&(day<=21)))
cout<<"您的星座为天蝎座,属性水\n";
else if(((month==11)&&(22<=day)&&(day<=30))||((month==12)&&(1<=day)&&(day<=21)))
cout<<"您的星座为射手座,属性气\n";
else if(((month==12)&&(22<=day)&&(day<=31))||((month==1)&&(1<=day)&&(day<=19)))
cout<<"您的星座为魔杰座,属性土\n";
else if(((month==1)&&(20<=day)&&(day<=31))||((month==2)&&(1<=day)&&(day<=18)))
cout<<"您的星座为水瓶座,属性气\n";
else
cout<<"您的星座为双鱼座,属性水\n";
cout<<"您是否要重新输入您的生日,“是”请输入Y,“否”请输入N\n";
cin>>retry;
}while(retry=='y'||retry=='Y');
}
麻烦大家看看我这段代码有什么问题吗?
为什么我每次编译都会提示“C++fatal error LNK1561: 必须定义入口点”
抱歉,没有多更多的分了,还望见谅。 展开
using namespace std;
void mian()
{ int month;
int day;
char retry;
do
{ cout<<"请输入您的出生月份\n";
cin>>month;
cout<<"请问您出生于"<<month<<"几号?\n";
cin>>day;
if ((day>31)||(month>12)||((month=2)&&(day>29))||(((month=4)||(month=6)||(month=9)||(month=11))&&(day>30)))
cout<<"您输入的是错误的日期\n";
else if(((month==3)&&(21<=day)&&(day<=31))||((month==4)&&(1<=day)&&(day<=19)))
cout<<"您的星座为白羊座,属性火\n";
else if(((month==4)&&(20<=day)&&(day<=30))||((month==5)&&(1<=day)&&(day<=20)))
cout<<"您的星座为金牛座,属性土\n";
else if(((month==5)&&(21<=day)&&(day<=31))||((month==6)&&(1<=day)&&(day<=21)))
cout<<"您的星座为双子座,属性气\n";
else if(((month==6)&&(22<=day)&&(day<=30))||((month==7)&&(1<=day)&&(day<=22)))
cout<<"您的星座为巨蟹座,属性水\n";
else if(((month==7)&&(23<=day)&&(day<=31))||((month==8)&&(1<=day)&&(day<=22)))
cout<<"您的星座为狮子座,属性火\n";
else if(((month==8)&&(23<=day)&&(day<=31))||((month==9)&&(1<=day)&&(day<=22)))
cout<<"您的星座为处女座,属性土\n";
else if(((month==9)&&(23<=day)&&(day<=30))||((month==10)&&(1<=day)&&(day<=22)))
cout<<"您的星座为天平座,属性气\n";
else if(((month==10)&&(23<=day)&&(day<=31))||((month==11)&&(1<=day)&&(day<=21)))
cout<<"您的星座为天蝎座,属性水\n";
else if(((month==11)&&(22<=day)&&(day<=30))||((month==12)&&(1<=day)&&(day<=21)))
cout<<"您的星座为射手座,属性气\n";
else if(((month==12)&&(22<=day)&&(day<=31))||((month==1)&&(1<=day)&&(day<=19)))
cout<<"您的星座为魔杰座,属性土\n";
else if(((month==1)&&(20<=day)&&(day<=31))||((month==2)&&(1<=day)&&(day<=18)))
cout<<"您的星座为水瓶座,属性气\n";
else
cout<<"您的星座为双鱼座,属性水\n";
cout<<"您是否要重新输入您的生日,“是”请输入Y,“否”请输入N\n";
cin>>retry;
}while(retry=='y'||retry=='Y');
}
麻烦大家看看我这段代码有什么问题吗?
为什么我每次编译都会提示“C++fatal error LNK1561: 必须定义入口点”
抱歉,没有多更多的分了,还望见谅。 展开
展开全部
#include<iostream>
using namespace std;
void main()
{
int month;
int day;
char retry;
while(retry=='y'||retry=='Y')
{
cout<<"请输入您的出生月份\n";
cin>>month;
cout<<"请问您出生于"<<month<<"几号?\n";
cin>>day;
if ((day>31)||(month>12)||((month=2)&&(day>29))||(((month=4)||(month=6)||(month=9)||(month=11))&&(day>30)))
cout<<"您输入的是错误的日期\n";
else if(((month==3)&&(21<=day)&&(day<=31))||((month==4)&&(1<=day)&&(day<=19)))
cout<<"您的星座为白羊座,属性火\n";
else if(((month==4)&&(20<=day)&&(day<=30))||((month==5)&&(1<=day)&&(day<=20)))
cout<<"您的星座为金牛座,属性土\n";
else if(((month==5)&&(21<=day)&&(day<=31))||((month==6)&&(1<=day)&&(day<=21)))
cout<<"您的星座为双子座,属性气\n";
else if(((month==6)&&(22<=day)&&(day<=30))||((month==7)&&(1<=day)&&(day<=22)))
cout<<"您的星座为巨蟹座,属性水\n";
else if(((month==7)&&(23<=day)&&(day<=31))||((month==8)&&(1<=day)&&(day<=22)))
cout<<"您的星座为狮子座,属性火\n";
else if(((month==8)&&(23<=day)&&(day<=31))||((month==9)&&(1<=day)&&(day<=22)))
cout<<"您的星座为处女座,属性土\n";
else if(((month==9)&&(23<=day)&&(day<=30))||((month==10)&&(1<=day)&&(day<=22)))
cout<<"您的星座为天平座,属性气\n";
else if(((month==10)&&(23<=day)&&(day<=31))||((month==11)&&(1<=day)&&(day<=21)))
cout<<"您的星座为天蝎座,属性水\n";
else if(((month==11)&&(22<=day)&&(day<=30))||((month==12)&&(1<=day)&&(day<=21)))
cout<<"您的星座为射手座,属性气\n";
else if(((month==12)&&(22<=day)&&(day<=31))||((month==1)&&(1<=day)&&(day<=19)))
cout<<"您的星座为魔杰座,属性土\n";
else if(((month==1)&&(20<=day)&&(day<=31))||((month==2)&&(1<=day)&&(day<=18)))
cout<<"您的星座为水瓶座,属性气\n";
else
cout<<"您的星座为双鱼座,属性水\n";
cout<<"您是否要重新输入您的生日,“是”请输入Y,“否”请输入N\n";
cin>>retry;
}
}
这就对了
是你主函数写错了
应该是main()
你写成mian()了
using namespace std;
void main()
{
int month;
int day;
char retry;
while(retry=='y'||retry=='Y')
{
cout<<"请输入您的出生月份\n";
cin>>month;
cout<<"请问您出生于"<<month<<"几号?\n";
cin>>day;
if ((day>31)||(month>12)||((month=2)&&(day>29))||(((month=4)||(month=6)||(month=9)||(month=11))&&(day>30)))
cout<<"您输入的是错误的日期\n";
else if(((month==3)&&(21<=day)&&(day<=31))||((month==4)&&(1<=day)&&(day<=19)))
cout<<"您的星座为白羊座,属性火\n";
else if(((month==4)&&(20<=day)&&(day<=30))||((month==5)&&(1<=day)&&(day<=20)))
cout<<"您的星座为金牛座,属性土\n";
else if(((month==5)&&(21<=day)&&(day<=31))||((month==6)&&(1<=day)&&(day<=21)))
cout<<"您的星座为双子座,属性气\n";
else if(((month==6)&&(22<=day)&&(day<=30))||((month==7)&&(1<=day)&&(day<=22)))
cout<<"您的星座为巨蟹座,属性水\n";
else if(((month==7)&&(23<=day)&&(day<=31))||((month==8)&&(1<=day)&&(day<=22)))
cout<<"您的星座为狮子座,属性火\n";
else if(((month==8)&&(23<=day)&&(day<=31))||((month==9)&&(1<=day)&&(day<=22)))
cout<<"您的星座为处女座,属性土\n";
else if(((month==9)&&(23<=day)&&(day<=30))||((month==10)&&(1<=day)&&(day<=22)))
cout<<"您的星座为天平座,属性气\n";
else if(((month==10)&&(23<=day)&&(day<=31))||((month==11)&&(1<=day)&&(day<=21)))
cout<<"您的星座为天蝎座,属性水\n";
else if(((month==11)&&(22<=day)&&(day<=30))||((month==12)&&(1<=day)&&(day<=21)))
cout<<"您的星座为射手座,属性气\n";
else if(((month==12)&&(22<=day)&&(day<=31))||((month==1)&&(1<=day)&&(day<=19)))
cout<<"您的星座为魔杰座,属性土\n";
else if(((month==1)&&(20<=day)&&(day<=31))||((month==2)&&(1<=day)&&(day<=18)))
cout<<"您的星座为水瓶座,属性气\n";
else
cout<<"您的星座为双鱼座,属性水\n";
cout<<"您是否要重新输入您的生日,“是”请输入Y,“否”请输入N\n";
cin>>retry;
}
}
这就对了
是你主函数写错了
应该是main()
你写成mian()了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
C++中用int main()
{
return 0;
}
{
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
注意,是main(),不是mian()。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询