日期:2014-05-18 浏览次数:20753 次
class Program { static void Main(string[] args) { Console.WriteLine("please input a string"); string a = Convert.ToString(Console.ReadLine()); string b = Convert.ToString(Console.ReadLine()); int i = 0; try { Console.WriteLine("a+b= {0} + {1}={2}", a, b, a+b); } catch (FormatException) { Console.WriteLine("输入不是整数"); } catch (DivideByZeroException) { Console.WriteLine("捕获到了除错误"); } Console.WriteLine("继续"); Console.ReadKey(); } }