1.看名字测缘分
//测缘分 Console.WriteLine("请输入姓名1:"); string name1 = Console.ReadLine(); Console.WriteLine("请输入姓名2:"); string name2 = Console.ReadLine(); int seed1 = 0; int seed2 = 0; if (name1.Length == 2) { seed1 = (int)Convert.ToChar(name1.Substring(0, 1)) + (int)Convert.ToChar(name1.Substring(1, 1)); } else { seed1 = (int)Convert.ToChar(name1.Substring(0, 1)) + (int)Convert.ToChar(name1.Substring(1, 1)) + (int)Convert.ToChar(name1.Substring(2, 1)); } Random a = new Random(seed1); int nan = a.Next(10); //Console.WriteLine(nan); if (name2.Length == 2) { seed2 = (int)Convert.ToChar(name2.Substring(0, 1)) + (int)Convert.ToChar(name2.Substring(1, 1)); } else { seed2 = (int)Convert.ToChar(name2.Substring(0, 1)) + (int)Convert.ToChar(name2.Substring(1, 1)) + (int)Convert.ToChar(name2.Substring(2, 1)); } Random b = new Random(seed2); int nv = b.Next(10); //Console.WriteLine(nv); int aaa = Math.Abs(nan-nv); //Console.WriteLine(aaa); if (aaa < 5 && aaa >= 0) { Console.WriteLine("你俩青梅竹马"); } else { Console.WriteLine("您俩差距太大了"); }
转载自原文链接, 如需删除请联系管理员。
原文链接:看名字测缘分、名字测身价,转载请注明来源!
相关推荐