我对此练习有一个问题:定义一个代表圆圈的类.保持pi值的常量定义类,以及在readonly中保持圆的颜色定义的变量.可能的颜色在枚举中定义.变量定义类以保持圆的半径和用于计算对象的周长和面积的函数.这就是我所做的:
class Circle
{
public const double PI = 3.14;
public readonly enum color { Black, Yellow, Blue, Green };
int radius;
public Circle(string Color,int radius)
{
this.radius = radius;
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何将枚举选择放在构造函数中.谢谢你的帮助.
我是JS的新手,每当有人使用Interent Explorer浏览器进入我的网站时,我都需要检测.所以,我做了下面的代码和我创建了其他Web浏览器被脚本股利我认为问题是与.getElementById或此类.所以在谈话之后,这里是代码:
<html>
<head>
<script type="text/javascript">
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
{
document.getElementById("example");
}
</script>
</head>
<body>
<div id ="example">You're Using Interent Explorer. </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
非常感谢帮助者.