⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c12_22.htm

📁 经典c语言教程
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>练习题二 </title>
<script language="javascript">
	function init(){
		err1=err1div.style;
		cor1=cor1div.style;
		err2=err2div.style;
		cor2=cor2div.style;
		err3=err3div.style;
		cor3=cor3div.style;
		hint1=hint1div.style;		
		hint2=hint2div.style;
		hint3=hint3div.style;
		error1times=0;
		error2times=0;
		error3times=0;
	}
	function show(obj){
		obj.display='';
	}
	function hide(obj){
		obj.display='none';
	}


	function judge1(){
		var s1=document.form1.C1.checked;
		var s2=document.form1.C2.checked;
		var s3=document.form1.C3.checked;
		var s4=document.form1.C4.checked;
		var s=(!s1)&&s2&&(!s3)&&s4;
		if(s){
			error1times=0;
			hide(hint1);
			hide(err1);
			show(cor1);
		}else{
			error1times++;
			if(error1times==3) show(hint1);
			hide(cor1);
			show(err1);
		}
	}

	function judge2(){
		var s1=document.form2.C1.checked;
		var s2=document.form2.C2.checked;
		var s3=document.form2.C3.checked;
		var s4=document.form2.C4.checked;
		var s=(!s1)&&s2&&(!s3)&&s4;
		if(s){
			error2times=0;
			hide(hint2);
			hide(err2);
			show(cor2);
		}else{
			error2times++;
			if(error2times==3) show(hint2);
			hide(cor2);
			show(err2);
		}
	}

	function judge3(){
		var s1=document.form3.C1.checked;
		var s2=document.form3.C2.checked;
		var s3=document.form3.C3.checked;
		var s4=document.form3.C4.checked;
		var s=(!s1)&&s2&&s3&&(!s4);
		if(s){
			error3times=0;
			hide(hint3);
			hide(err3);
			show(cor3);
		}else{
			error3times++;
			if(error3times==3) show(hint3);
			hide(cor3);
			show(err3);
		}
	}


</script>
</head>

<body bgcolor="#ccefcc" onLoad="init()">

<blockquote>
  <p>从下面选出与 043 相等的项, 然后送入其编号。</p>
  <form name="form1">
    <p>第一组<br>
    1.<input type="checkbox" name="C1" value="ON">15&nbsp;&nbsp; 2.<input type="checkbox"
    name="C2" value="ON">0x23&nbsp;&nbsp; 3.<input type="checkbox" name="C3" value="ON">3.5E+1&nbsp;&nbsp;&nbsp; 
    4.<input type="checkbox" name="C4" value="ON">17+18&nbsp;<input type="button"
    value="确认" name="B1" onClick="judge1()"></p>
  </form>
  <div id="err1div" style="display:'none'"><p><font color="#FF0000">做错了。再做一次!</font> 
  </p>
  </div><div id="cor1div" style="display:'none'"><font color="#FF0000"><p>正确! 
  做得很好!</font> 请把 043 转换为 10 进制数。043 和十进制数 35 相等。3.5E+1 
  是一个实型数, 故它和 043 不相等。0x23 和 2*16+3=35=043 是相等的。</p>
  </div><div id="hint1div" style="display:'none'"><p>正确答案是: 2, 4</p>
  </div><form name="form2">
    <p>第二组<br>
    1.<input type="checkbox" name="C1" value="ON">3.5E1&nbsp;&nbsp;&nbsp; 2.<input
    type="checkbox" name="C2" value="ON">0X23&nbsp;&nbsp; 3.<input type="checkbox" name="C3"
    value="ON">45&nbsp;&nbsp;&nbsp; 4.<input type="checkbox" name="C4" value="ON">0x17+0xC <input
    type="button" value="确认" name="B1" onClick="judge2()"></p>
  </form>
  <div id="err2div" style="display:'none'"><p><font color="#FF0000">做错了。再做一次!</font> 
  </p>
  </div><div id="cor2div" style="display:'none'"><font color="#FF0000"><p>正确! 
  做得很好!</font> 请把 043 转换为 10 进制数。043 和十进制数 35 相等。3.5E1 
  是一个实型数, 故它和 043 不相等。0x17+0xc 和 16+7+12=35=043 是相等的。0X23 
  和 0x23 以及 043 是相等的。</p>
  </div><div id="hint2div" style="display:'none'"><p>正确答案是: 2, 4</p>
  </div><form name="form3">
    <p>第三组<br>
    1.<input type="checkbox" name="C1" value="ON">0x37&nbsp;&nbsp; 2.<input type="checkbox"
    name="C2" value="ON">35&nbsp;&nbsp; 3.<input type="checkbox" name="C3" value="ON">0x46-043&nbsp;&nbsp;&nbsp; 
    4.<input type="checkbox" name="C4" value="ON">65 <input type="button" value="确认"
    name="B1" onClick="judge3()"></p>
  </form>
  <div id="err3div" style="display:'none'"><p><font color="#FF0000">做错了。再做一次!</font> 
  </p>
  </div><div id="cor3div" style="display:'none'"><font color="#FF0000"><p>正确! 
  做得很好!</font> 0x37 和 3*16+7=55 是相等的。0x46-043 的 
  (4*16+6)-(4*8+3)=35=043 是相等的。</p>
  </div><div id="hint3div" style="display:'none'"><p>正确答案是: 2,&nbsp; 3</p>
  </div>
</blockquote>

<p align="center"><a href="javascript:close()">关闭</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -