编辑代码

using System;

namespace hello
{
    class world
    {
        static void Main()
        {
            double b = 178.616f;  // 1. 修复:float 必须加 'f' 后缀
            while (true)
            {
                string password = Console.ReadLine();
                int a = (int)b;  // 2. 修复:int.Parse() 只能处理字符串,这里改用强制转换

                if (password == "open system 200")
                {
                    Console.WriteLine("密码正确");
                    break;  // 退出循环
                }
                else
                {
                    Console.BackgroundColor = ConsoleColor.Red;  // 3. 修复:正确的颜色设置语法
                    Console.ForegroundColor = ConsoleColor.White; // 可选:设置文字颜色为白色
                    Console.WriteLine("密码错误,请重试");
                    Console.ResetColor();  // 恢复默认颜色
                }
            }
        }
    }
}