发布网友 发布时间:2024-10-24 09:55
共2个回答
热心网友 时间:2024-11-05 02:11
[vb.net]
Console.WriteLine("请输入半径")
Dim str = Console.ReadLine()
Dim r = 0.0
If Double.TryParse(str, r) Then
Console.WriteLine("半径={0},面积是:{1}", r, 3.1415926 * r * r)
Else
Console.WriteLine("亲~~!非数字!")
End If
----[c#.net]
Console.WriteLine("请输入半径");
var str = Console.ReadLine();
var r = 0.0;
If (Double.TryParse(str, r) )
Console.WriteLine("半径={0},面积是:{1}", r, 3.1415926 * r * r);
Else
Console.WriteLine("亲~~!非数字!");
热心网友 时间:2024-11-05 02:12
Console.WriteLine("input rad:");
var str = Console.ReadLine();
var r = 0.0;
if (Double.TryParse(str, out r))
Console.WriteLine("rad ={0},area={1}", r, 3.1415926 * r * r);
else
Console.WriteLine("It's not Numeric!");