c++期末作业,有一个错误一直改不了,
int main()//主函数进行彩票开奖{
char c;//循环答案
bool flag;//用于事件控制循环
flag=true;
while(flag)
{
cout<<"now the game begin!"<<endl;
printline();
cout<<"~~~~~~~~~~彩票游戏~~~~~~~~~~"<<endl;
printline();
printword();
printline();
cout<<"~~~~~~~~~~祝您好运~~~~~~~~~~"<<endl;
printline();
cout<<"请输入您的初始金额:"<<endl;
int sum;//账户初额
cin>>sum;
if (sum>=2);
{
sum=sum-2;//下注
}
117 else
{
cout<<sum<<endl;break;
}
int jiangxiang=caipiaoyanzheng();//奖金的注入
if(jiangxiang==0)
{
sum=sum;
}
else if(jiangxiang==1)
{
sum=sum;
}
else if(jiangxiang==2)
{
sum=sum+50;
}
else if(jiangxiang==3)
{
sum=sum+1000;
}
else if(jiangxiang==4)
{
sum=sum+1000000;
}
else if(jiangxiang==5)
{
sum=sum+2000000;
}
else if(jiangxiang==6)
{
sum=sum+5000000;
}
cout<<"您的余额为:"<<sum<<endl;//输出余额
cout<<"是否继续进行彩票游戏,是输入[Y]或[y],否输入其他字符"<<endl;//彩票循环提示
cin>>c;
if(!(c=='y'||c=='Y'))flag=false;
}
}
117 4 D:Untitled1.cpp [Error] 'else' without a previous 'if'
为什么这个else没办法修改,到底该怎么该,跪求大佬