苏飞论坛
标题:
无法将类型“string”隐式转换为"double"
[打印本页]
作者:
站长苏飞
时间:
2013-9-3 18:02
标题:
无法将类型“string”隐式转换为"double"
HeiMa -() 17:58:17
file:///D:\Documents\Tencent Files\361983679\Image\Image1\]_}5XYKFPUF${O{1Y1PJQH8.jpg无法将类型“string”隐式转换为"double"
这个用啥转换啊
求教·
♂Inghot<> 17:58:51
Convert.
♂[渝]版主-Eagle() 17:58:53
dobule.input()
♂hudson<> 17:58:54
Convert.ToDouble()
♂[渝]版主-Eagle() 17:59:35
(dobule)string
自己拿捏着办
HeiMa -() 17:59:56
[img]file:///D:\Documents\Tencent Files\361983679\Image\Image1\MTO%UF`GC7$
4E9@W5M45YIN.jpg
[/img]
♂[渝]版主-Eagle() 18:00:25
要把你想转的放方法里面去
HeiMa -() 18:00:51
[code=csharp] string Xm;
double Sg;
double Tz;
string Mp = "你要买票了";
string Bp = "你不用买票";
Console.WriteLine("请输入你的姓名:");
Xm = Console.ReadLine();
Console.WriteLine("请输入你的身高:");
Sg =(dobule)string(Console.ReadLine());
Console.WriteLine("请输入你的体重:");
Tz =(dobule)string(Console.ReadLine());
if (Sg >= 17.3 || Tz >= 60)
{
Console.WriteLine(Mp);
}
else
{
Console.WriteLine(Bp);
}
Console.ReadKey();[/code]
放在哪里啊
♂站长苏飞() 18:01:54
[code=csharp]double b = Convert.ToDouble("1.2263"); [/code]
欢迎光临 苏飞论坛 (http://www.sufeinet.com/)
Powered by Discuz! X3.4