char ans;
do
{
float result;
float x = 0;
float y = 0;
Console.Write("Input x:");
x = float.Parse(Console.ReadLine());
Console.Write("Input y:");
y = float.Parse(Console.ReadLine());
Console.WriteLine("_________________________");
result = x+y;
Console.WriteLine("{0}+{1} ={2,5}", x, y, result);
Console.WriteLine("_________________________");
result = x-y;
Console.WriteLine("{0}-{1} ={2,5}", x, y, result);
Console.WriteLine("_________________________");
result = x*y;
Console.WriteLine("{0}*{1} ={2,5}", x, y, result);
Console.WriteLine("_________________________");
result = x/y;
Console.WriteLine("{0}/{1} ={2,5}", x, y, result);
Console.WriteLine("_________________________");
result = x%y;
Console.WriteLine("{0}%{1} ={2,5}", x, y, result);
Console.WriteLine("_________________________");
Console.Write("Do you want exit....(y/n)?+++++++++++++++++++++++++++++++++++++++++");
ans = char.Parse(Console.ReadLine());
}while(ans=='n');
string s = "-.4";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^([+]|[-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$");
if (reg.IsMatch(s))
{
MessageBox.Show("hi");
}
เป็น Real Number
+1, -1, -.2, +12,-0.5,-4,+4 ฯลฯ ได้หมด