#作業(yè)要求
提示用戶輸入密碼,如果密碼是“88888”則提示正確,否則要求再輸入一次,如果密碼是“88888”則提示正確,否則提示錯誤,程序結(jié)束。
#程序
namespace ConsoleApplication1
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? Console.WriteLine("請輸入密碼");
? ? ? ? ? ? int a = Convert.ToInt32(Console.ReadLine());
? ? ? ? ? ? if(a==88888)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("密碼正確");
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("請重新輸入密碼");
? ? ? ? ? ? ? ? int b=Convert.ToInt32(Console.ReadLine());
? ? ? ? ? ? ? ? if (b == 88888)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.WriteLine("密碼正確");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.WriteLine("密碼輸入錯誤,退出程序");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadLine();
? ? ? ? }
? ? }
}
#效果

