//loop
while (playercash > 0)
{
Console.WriteLine(" Dealer: How much you want to bet on? By the way, you have $200.");
Console.WriteLine("");
int playerbet = int.Parse(Console.ReadLine());
Console.WriteLine("");
Console.WriteLine(" Dealer: You bet $" + playerbet + " on this game.");
Console.ReadKey();
Console.WriteLine(" Dealer: You have 5 choices!");
Console.ReadKey();
Console.WriteLine("\n1 = Small \t2 = Big \n3 = Odd \t4 = Even \n5 = Triples");
Console.ReadKey();
Console.WriteLine(" Dealer: Which one that you want to bet on?");
string playerchoice = Console.ReadLine();
//If
if (playerchoice == "1" || playerchoice == "small")
{
//Show name
Console.ReadKey();
Console.WriteLine(" Dealer: You chose Small!");
Console.WriteLine("");
Console.ReadKey();
Console.WriteLine("Rolling Dice..");
Console.WriteLine("");
Console.ReadKey();
//Print the numbers that were stored
Console.WriteLine("Dice 1: " + dice1);
Console.WriteLine("Dice 2: " + dice2);
Console.WriteLine("Dice 3: " + dice3);
Console.WriteLine("");
Console.WriteLine("Total = " + total);
if (total < 11) ;
{
Console.WriteLine("");
Console.ReadKey();
Console.WriteLine("You Win!");
playercash = playerbet + playercash;
Console.WriteLine("You just earned $" + playerbet + "!!");
Console.WriteLine("Now you have $" + playercash + "!!!");
}
if (total > 10) ;
{
Console.WriteLine("");
Console.ReadKey();
Console.WriteLine("You Lose!");
playercash = playerbet - playercash;
Console.WriteLine("You just lost $" + playerbet + "!!");
Console.WriteLine("Now you have $" + playercash + "!!!");
}
}
}
저렇게하면 total이 10 이상일때 lose가 안뜨고
마지막 if 절을 else if 절로 바꾸면
저렇게 에러가 납니다.
if, else if 둘다 if (playerchoice == "1" || playerchoice == "small") 안에 들어가야하는 애들인데
에러가 else if 위에 닫는 } 입력해서 else if 는 if (playerchoice == "1" || playerchoice == "small") 밖으로 나가는 else if 절로 만들더라고요
어떻게 해결해야하나요??