#代码
string strNumber="";
do
{
Console.WriteLine("请输入数字");
strNumber = Console.ReadLine();
if
(strNumber != "q")
{
try
{
int number = Convert.ToInt32(strNumber);
Console.WriteLine("这个数字的2倍是{0}", number * 2);
}
catch
{
Console.WriteLine("输入有误,请重新输入");
}
}
else
{
Console.WriteLine("你输入的是q,程序退出!!!");
}
} while (strNumber != "q");
Console.ReadKey();