📄 c22_31.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>练习题 </title>
<script language="javascript">
function init(){
cor=cordiv.style;
err=errdiv.style;
hint=hintdiv.style;
errortimes=0;
}
function show(obj){
obj.display='';
}
function hide(obj){
obj.display='none';
}
function judge(){
var s=document.form.T1.value;
if(s=="falsetrue 2,3"){
errortimes=0;
hide(hint);
hide(err);
show(cor);
}else{
errortimes++;
if(errortimes==3) show(hint);
hide(cor);
show(err);
}
}
</script>
</head>
<body bgcolor="#ccefcc" onLoad="init()">
<blockquote>
<div align="center"><center><table border="6" width="274" cellspacing="0" cellpadding="6"
height="201" bordercolor="#FF9933">
<tr>
<th width="498" bgcolor="#FF9933" height="11">程序</th>
</tr>
<tr>
<td ALIGN="center" width="498" bgcolor="#00FFFF" height="162"><p align="left">int a=1;<br>
int b=2;<br>
int c=3;<br>
switch ((a=b)==c)<br>
{<br>
case 0: printf("false");<br>
case 1: printf("true ");<br>
case 2:<br>
case 3: printf("2,3");<br>
}</td>
</tr>
</table>
</center></div><form name="form">
<p>这个程序的输出是:<input type="text" name="T1" size="21"><input type="button"
value="Enter" name="B1" onClick="judge()"></p>
</form>
<div id="cordiv" style="display:'none'"><font color="#0000FF"><p>正确! 做的很好!</font></p>
</div><div id="errdiv" style="display:'none'"><p><font color="#FF0000">错误!
再做一次!</font></p>
</div><div id="hintdiv" style="display:'none'"><p>(a=b)==c ==>
(a=2)==3 ==> (2)==3 ==>
FALSE ==> 0<br>
<br>
case 0: 中没有 break 语句。<br>
case 1,2: 中没有 break 语句。<br>
<br>
正确答案是: <br>
falsetrue 2,3</p>
<p><font color="#FF0000">你要加把劲!</font></p>
</div>
</blockquote>
<p align="center"><a href="javascript:close()">关闭</a></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -