class Program { static void Main(string[] args) { try { Console.Write("请输入二元一次方程的系数a:"); int a = int.Parse(Console.ReadLine()); Console.Write("请输入二元一次方程的系数b:"); int b = int.Parse(Console.ReadLine()); Console.Write("请输入二元一次方程的系数c:"); int c = int.Parse(Console.ReadLine()); ABC t = new ABC(a, b, c); t.GetRoot(); } catch (ABCException e) { Console.WriteLine(e.Message); } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void Main(string[] args) { try { Console.WriteLine("二元一次方程的格式为ax^2+bx+c=0"); Console.Write("请输入二元一次方程的系数a:"); int a = int.Parse(Console.ReadLine()); Console.Write("请输入二元一次方程的系数b:"); int b = int.Parse(Console.ReadLine()); Console.Write("请输入二元一次方程的系数c:"); int c = int.Parse(Console.ReadLine()); ABC cm = new ABC(a, b, c); cm.GetRoot(); } catch (ABCException e) { Console.WriteLine(e.Message); } catch (Exception e) { Console.WriteLine(e.Message); } }