C#/수업 내용

[C#] else if

JSH1 2021. 8. 19. 12:41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace hello_world
{
    class Program
    {
        static void Main(string[] args)
        {
            bool check = false;
            Console.Write("아이디를 입력하세요: ");
            string id = Console.ReadLine();

            while (!check)
            {
                Console.Write("비밀번호를 입력하세요: ");
                string pass = Console.ReadLine();

                Console.Write("비밀번호를 다시 입력하세요: ");
                string pass_check = Console.ReadLine();

                if (pass == pass_check)
                {
                    check = true;
                }

                else
                {
                    Console.WriteLine("비밀번호가 틀렸습니다. 다시 입력해주세요\n");
                }
            }
                    Console.WriteLine("{0}님 환영합니다.", id);
        }
    }
}


 

'C# > 수업 내용' 카테고리의 다른 글

[C#] Random  (0) 2021.08.20
2021-08-19 연습문제  (0) 2021.08.19
[C#] if  (0) 2021.08.19
[C#] 논리 연산자  (0) 2021.08.19
[C#] 산술 연산자  (0) 2021.08.18