Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
DN2
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Data; using System.Threading; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here List<string> q = new List<string>(); DataTable dt = new DataTable(); double Value; int a = Rand.Next(2,10); int b = Rand.Next(2,10); int c = Rand.Next(2,10); //q.Add("4"+"+2"); //q.Add("4+2/2*4"); //q.Add("3*0-2"); q.Add(a+"-"+b+"*"+c); foreach (string member in q) { Value = Convert.ToDouble(dt.Compute(member, null)); Console.Write(member+"=" ); Console.WriteLine(Value); } } } /// Rand public static class Rand { /// <summary> /// Random number generator used to generate seeds, /// which are then used to create new random number /// generators on a per-thread basis. /// </summary> private static readonly Random globalRandom = new Random(); private static readonly object globalLock = new object(); /// <summary> /// Random number generator /// </summary> private static readonly ThreadLocal<Random> threadRandom = new ThreadLocal<Random>(NewRandom); /// <summary> /// Creates a new instance of Random. The seed is derived /// from a global (static) instance of Random, rather /// than time. /// </summary> public static Random NewRandom() { lock (globalLock) { return new Random(globalRandom.Next()); } } /// <summary> /// Returns an instance of Random which can be used freely /// within the current thread. /// </summary> public static Random Instance { get { return threadRandom.Value; } } /// <summary>See <see cref="Random.Next()" /></summary> public static int Next() { return Instance.Next(); } /// <summary>See <see cref="Random.Next(int)" /></summary> public static int Next(int maxValue) { return Instance.Next(maxValue); } /// <summary>See <see cref="Random.Next(int, int)" /></summary> public static int Next(int minValue, int maxValue) { return Instance.Next(minValue, maxValue); } /// <summary>See <see cref="Random.NextDouble()" /></summary> public static double NextDouble() { return Instance.NextDouble(); } /// <summary>See <see cref="Random.NextBytes(byte[])" /></summary> public static void NextBytes(byte[] buffer) { Instance.NextBytes(buffer); } public static double NextD(double minValue, double maxValue) { return Instance.NextDouble()*(maxValue-minValue)+minValue; } } }
run
|
edit
|
history
|
help
0
/*Dizide bulunan sayıların en büyük iki ve en küçük ikisini bulma*/
Point in Circle
VB6 DateSerial to C#
my sql
Social
aa
Case where use of default constructor ( this() ) is mandatory
SAF Mid Terms
1213
Fusion