提示这样的错误 求解决

xiaowangbadandan 2009-03-06 04:24:23
bool mybool = false;
string mypassword;
do
{
Console.WriteLine("请输入你的姓名代号:");
Console.WriteLine("(1)张三,(2)李四,(3)王五");
//int myid = Convert.ToInt32(Console.ReadLine().Trim());
int myid = -1;
try
{
Convert.ToInt32(Console.ReadLine());
}
catch
{
}
if (myid = -1)
{
Console.WriteLine("你输入的有误");
}
else
{
switch (myid)
{
case 1: Console.WriteLine("请输入你的密码:");
mypassword = Console.ReadLine().Trim();
if (mypassword == "zhang")
{
Console.WriteLine("密码正确:");
mybool = true;
}
else
{
Console.WriteLine("密码错误!");
}
break;
case 2:
Console.WriteLine("请输入你的密码:");
mypassword = Console.ReadLine().Trim();
if (mypassword == "li")
{
Console.WriteLine("密码正确:");
mybool = true;
}
else
{
Console.WriteLine("密码错误!");
}
break;
case 3:
Console.WriteLine("请输入你的密码:");
mypassword = Console.ReadLine().Trim();
if (mypassword == "wang")
{
Console.WriteLine("密码正确:");
mybool = true;
}
else
{
Console.WriteLine("密码错误!");
}
break;
default:
Console.WriteLine("查无此人!");
break;
}
}
} while (!mybool);
Console.WriteLine("谢谢使用,系统退出.......\n按回车键退出!");
Console.ReadLine();


提示错误 无法将类型“int”隐士转换为“bool”
...全文
50 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wsq279024988 2009-03-06
  • 打赏
  • 举报
回复
看看啊
贫僧又回来了 2009-03-06
  • 打赏
  • 举报
回复
JF
sprc_lcl 2009-03-06
  • 打赏
  • 举报
回复
if (myid == -1)

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧