Using system;using system.collections.generic;using system.linq;using system.text;using System.text.regularexpressions;namespace consoleapplication2{class Program {static int sun; private static int x, y, Z; private static string F; private static string H; static void Main (string[] args) {Console.Write ("Please enter the range of random numbers (9-10):"); String azzz = Console.ReadLine (); string regex = @ "(\d+) \d+ (\d+)"; Match MSTR = Regex.match (azzz, Regex); int s1 = Int. Parse (MSTR. GROUPS[1]. Value); int s2 = Int. Parse (MSTR. GROUPS[2]. Value); Random (S1,S2); Console.Write ("Please enter answer:"); int l = Int. Parse (Console.ReadLine ()); Rightanswer (F, h, X, Y, z); if (L = = Sun) {Console.WriteLine ("Answer right!") "); } else {Console.WriteLine ("Answer Error! "); } console.read (); } private static void random (int a,int b) {Random si = new random (); x = Si. Next (A, b); y = si. Next (A, x); z = si. Next (A, y); string[] operators = new string[] {"+", "-", "*", "/"}; f = operators[new Random (). Next (0, 4)]; h = operators[new Random (). Next (0, 4)]; String z1 = "="; String xfyhz = x + F + y + H + z + z1; Console.WriteLine (xfyhz); } private static int Rightanswer (String a1, string a2, int c, int d, int e) {string A12 = A1 + A 2; Switch (A12) {case "+ +": Sun = C + D + E; Break Case "+-": Sun = c + d-e; Break Case "-+": Sun = c-d + E; Break Case "--": Sun = c-d-E; Break Case "-*": Sun = c-d * e; Break Case "+*": Sun = C + D + E; Break Case "* *": Sun = c * D/E; Break Case "* *": Sun = c * d * e; Break Case "* *": Sun = c + d-e; Break Case "*+": Sun = c * D + E; Break Case "/*": Sun = C/D * e; Break Case "/-": Sun = C/D-E; Break Case "/+": Sun = C/D + E; Break Case "//": Sun = C/D/E; Break Case "-/": Sun = c-d/E; Break Case "+/": Sun = c + d/e; Break } return Sun; } }}
Summarize:
It's been a long time, and it's a little bit of detail that will determine if the program is running successfully! Write code should be careful, carefully, and carefully!
Hybrid operations (console)