public static string Shunting(string str) { Priority(); Dismantling(str); while (strStk.Count != 0) { Value_ToDig(iStk, strStk); } if (CM30.IsDouble(iStk.Peek().ToString()) == false) { double IStk = Convert.ToDouble(iStk.Peek()); return(IStk.ToString()); } return(iStk.Peek()); }
//用户自定义 /// <summary> /// /// </summary> /// <param name="exercises">题目数量</param> /// <param name="range">数据范围</param> /// <param name="operators">符号数量</param> /// <param name="operatorClass">符号种类</param> /// <param name="isFraction">是否支持真分数运算</param> /// <param name="isDecimal">是否支持小数运算</param> /// <param name="isInvolution">是否支持乘方运算</param> public static void ProblemSet(int exercises, int range, int operators, int operatorClass, bool isFraction, bool isDecimal, bool isInvolution) { for (int i = 0; i <= range; i++) { if (isFraction)//分数 { } if (isDecimal)//小数 { CM30.Random_Number(isDecimal, range); } if (isInvolution)//乘方 { } } }
//随机产生小数和整数 public static double DecimalAndInteger(int range) { double item = 0.0; Random l = new Random(); var bo = l.Next(1, 3); if (bo == 1) { item = CM30.Random_Number(true, range); } else { item = CM30.Random_Number(false, range); } return(item); }
//用户自定义 /// <summary> /// /// </summary> /// <param name="exercises">题目数量</param> /// <param name="range">数据范围</param> /// <param name="operators">符号数量</param> /// <param name="operatorClass">符号种类</param> /// <param name="isFraction">是否支持真分数运算</param> /// <param name="isDecimal">是否支持小数运算</param> /// <param name="isInvolution">是否支持乘方运算</param> public static void ProblemSet(int exercises, int range, int operators, string[] operatorClass, bool isFraction, bool isDecimal, bool isInvolution) { List <string> Expression = new List <string>(); List <string> Answer = new List <string>(); int Rannum = l.Next(1, 3); if (isFraction && Rannum == 1)//带分数 { CM30.OpNumber(range, exercises, operators, operatorClass, true, true, false, ref Expression, ref Answer); CM21.Injection(Expression.ToArray(), Answer.ToArray()); } else//带小数 { CM30.OpNumber(range, exercises, operators, operatorClass, false, true, false, ref Expression, ref Answer); CM21.Injection(Expression.ToArray(), Answer.ToArray()); } }
//年级配置 /// <summary> /// /// </summary> /// <param name="grades">年级</param> /// <param name="exercises">题目数量</param> /// <param name="range">范围</param> /// <param name="Operators">符号</param> public static void IsGrades(int grades, int exercises, int range, int Operators) { List <string> Expression = new List <string>(); List <string> Answer = new List <string>(); switch (grades) { case 1: calculation = new string[] { "+", "-" }; CM30.OpNumber(range, exercises, Operators, calculation, false, false, false, ref Expression, ref Answer); Injection(Expression.ToArray(), Answer.ToArray()); break; case 2: CM30.OpNumber(range, exercises, Operators, calculation, false, false, false, ref Expression, ref Answer); Injection(Expression.ToArray(), Answer.ToArray()); break; case 3: CM30.OpNumber(range, exercises, Operators, calculation, true, false, false, ref Expression, ref Answer); Injection(Expression.ToArray(), Answer.ToArray()); break; case 4: CM30.OpNumber(range, exercises, Operators, calculation, true, true, false, ref Expression, ref Answer); Injection(Expression.ToArray(), Answer.ToArray()); break; case 5: CM30.OpNumber(range, exercises, Operators, calculation, true, true, false, ref Expression, ref Answer); Injection(Expression.ToArray(), Answer.ToArray()); break; case 6: CM30.OpNumber(range, exercises, Operators, calculation, true, true, true, ref Expression, ref Answer); Injection(Expression.ToArray(), Answer.ToArray()); break; default: break; } }
public static void IsGrades(int grades, int exercises, int range, int Operators) { string[] Expression = new string[exercises]; string[] Answer = new string[exercises]; switch (grades) { case 1: CM30.OpNumber(range, exercises, Operators, 2, false, ref Expression, ref Answer); Injection(Expression, Answer); break; case 2: CM30.OpNumber(range, exercises, Operators, 4, false, ref Expression, ref Answer); Injection(Expression, Answer); break; case 3: CM30.OpNumber(range, exercises, Operators, 4, false, ref Expression, ref Answer); Injection(Expression, Answer); break; case 4: CM30.OpNumber(range, exercises, Operators, 4, true, ref Expression, ref Answer); Injection(Expression, Answer); break; case 5: CM30.OpNumber(range, exercises, Operators, 4, true, ref Expression, ref Answer); Injection(Expression, Answer); break; case 6: CM30.OpNumber(range, exercises, Operators, 4, true, ref Expression, ref Answer); Injection(Expression, Answer); break; default: break; } }