1 public class IsopsephyNumber
2 {
3 private double value = 0.0;
4 private bool isFlag = false;
5 /// <summary>
6 /// 奇进偶不进
7 /// </summary>
8 public void JiNumInAndOuNunOut()
9 {
10 while (true)
11 {
12 string numberStr = Console.ReadLine();
13 if (!string.IsNullOrEmpty(numberStr) && numberStr.Trim().ToLower().Equals("exit"))
14 {
15 break;
16 }
17 JudgeNumber(numberStr, out value, out isFlag);
18 if (isFlag)
19 {
20 double result = Math.Round(value, 3, MidpointRounding.ToEven);
21 Console.WriteLine("结果:" + result + ":" + value);
22 }
23 }
24 }
25
26 private static void JudgeNumber(string numberStr, out double value, out bool isFlag)
27 {
28 value = 0.0;
29 isFlag = double.TryParse(numberStr, out value);
30 }
31 }