Hybrid operations (console)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.