檢查帳號密碼程式

 string s1,s3;
            Console.WriteLine("請輸入帳號:");
            s1 = Console.ReadLine();
            Console.WriteLine("請輸入密碼:");
            s3 = Console.ReadLine();

            string s2 = "1234";
            string s4 = "5678";
           
            int Result;
            Result = s1.CompareTo(s2);
           
            int Result1;
            Result1 = s3.CompareTo(s4);

            if (Result == 0 & Result1 == 0)
                Console.WriteLine("歡迎光臨!");

            else if (Result != 0 & Result1 != 0)
                Console.WriteLine("帳號錯誤&密碼錯誤!");

            else if (Result != 0)
                Console.WriteLine("帳號錯誤!");

            else if(Result1 !=0)
                Console.WriteLine("密碼錯誤!");
           
            Console.ReadLine();

arrow
arrow
    全站熱搜

    ㄡ ㄋㄧ' ㄦ 發表在 痞客邦 留言(1) 人氣()