C#/수업내용
0309 C# 강화 성공, 실패
HappyFrog
2021. 3. 9. 15:30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Homework000
{
class Program
{
static void Main(string[] args)
{
//삼항 연산자
//string result = 1 > 3 ? "사실" : "거짓";
//int result = 1 > 3 ? 100 : 200;
//Console.WriteLine(result);
int reinforcePercent = 13;
Random rand = new Random();
int num = rand.Next(0, 101);
int gold = 1000;
if(num < reinforcePercent)
{
Console.WriteLine("강화를 성공했습니다.");
//강화 성공했고
if (gold > 20000)
{
//돈이 있다면
}
}
else
{
Console.WriteLine("강화를 실패했습니다.");
//강화 실패
}
}
}
}