Advertisement
Guest User

CalcAlan

a guest
Oct 17th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Calculadora
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             Console.WriteLine("----------------------------------------------------------");
  15.             Console.WriteLine("----------------------------------------------------------");
  16.             Console.WriteLine("--------------------Elige opción: ------------------------");
  17.             //Elije opcion 1  -> lectura y escritura en fichero y 2 bucle while de compilacion
  18.             Console.WriteLine("Dame tu ecuación matemática: ");
  19.  
  20.            
  21.             MatchCollection matches = Regex.Matches("98009", "[1-9]+[0-9]*",RegexOptions.IgnorePatternWhitespace);
  22.             Console.WriteLine("Found {0} matches.", matches.Count);
  23.  
  24.             Calculadora calc = new Calculadora();
  25.             Console.WriteLine(calc.CadenaAEvaluar(Console.ReadLine()));
  26.         }
  27.     }
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. ---------------------
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. using System;
  53. using System.Collections.Generic;
  54. using System.Linq;
  55. using System.Text;
  56. using System.Threading.Tasks;
  57. using System.Data;
  58.  
  59. namespace Calculadora{
  60.  
  61.     class Calculadora{
  62.  
  63.         DataTable dt;
  64.  
  65.         public Calculadora() {
  66.             dt = new DataTable();
  67.            
  68.         }
  69.  
  70.         public String CadenaAEvaluar(String cadenaAEvaluar) {
  71.             var v = dt.Compute(cadenaAEvaluar, "");
  72.             return v.ToString();
  73.         }
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement