日期:2014-05-17 浏览次数:20947 次
static double ReadDouble()
{
char ch = '\0';
do
{
ch = (char)Console.Read();
} while (!(ch != '\t' && ch != '\n' && ch != ' '));
string str = "";
str += ch;
while (true)
{
ch = (char)Console.Read();
if (ch != '\t' && ch != '\n' && ch != ' ')
str += ch;
else
break;
}
return double.Parse(str);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double d = ReadDouble();
Console.WriteLine(d);
}
private static double ReadDouble()
{
char ch = '\0';
string s = "";
while (true)
{
ch = (char)Console.ReadKey().KeyChar;
if (new char[] { '\r', '\t', ' ' }.Contains(ch))
{