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