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

📄 c11_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;
		exp=expdiv.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 s5=document.form1.C5.checked;
		var s=s1&&s2&&(!s3)&&(!s4)&&s5;
		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 s5=document.form2.C5.checked;
		var s=s1&&s2&&(!s3)&&s4&&s5;
		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 s5=document.form3.C5.checked;
		var s=s1&&s2&&(!s3)&&(!s4)&&s5;
		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>下面是三组用户定义的标识符, 
  请从中选出正确的。请你选出正确标识符。</p>
  <form name="form1">
    <p>第一组<br>
    1.<input type="checkbox" name="C1" value="ON">Piece_f&nbsp;&nbsp;&nbsp; 2.<input
    type="checkbox" name="C2" value="ON">Sum&nbsp;&nbsp;&nbsp; 3.<input type="checkbox"
    name="C3" value="ON">union&nbsp;&nbsp;&nbsp; 4.<input type="checkbox" name="C4" value="ON">float&nbsp;&nbsp;&nbsp; 
    5.<input type="checkbox" name="C5" value="ON">__<br>
    <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> 'union' 是保留字, 故不是合法的标识符。'float' 
  是保留字, 故不是合法的标识符。</p>
  </div><div id="hint1div" style="display:'none'"><p>正确答案是: 1, 2, 5</p>
  </div><form name="form2">
    <p>第二组<br>
    1.<input type="checkbox" name="C1" value="ON">University&nbsp;&nbsp;&nbsp; 2.<input
    type="checkbox" name="C2" value="ON">Room401&nbsp;&nbsp;&nbsp; 3.<input type="checkbox"
    name="C3" value="ON">2a&nbsp;&nbsp;&nbsp; 4.<input type="checkbox" name="C4" value="ON">t23e&nbsp;&nbsp;&nbsp; 
    5.<input type="checkbox" name="C5" value="ON">i<br>
    <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> 2a 是以数字 '2' 开始的, 故是非法的标识符。</p>
  </div><div id="hint2div" style="display:'none'"><p>正确答案是: 1, 2, 4, 5</p>
  </div><form name="form3">
    <p>第三组<br>
    1.<input type="checkbox" name="C1" value="ON">true&nbsp;&nbsp; 2.<input type="checkbox"
    name="C2" value="ON">false&nbsp;&nbsp;&nbsp; 3.<input type="checkbox" name="C3" value="ON">main&nbsp;&nbsp;&nbsp; 
    4.<input type="checkbox" name="C4" value="ON">A$?&nbsp;&nbsp;&nbsp; 5.<input
    type="checkbox" name="C5" value="ON">Loali<br>
    <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> 'main' 是保留字, 故不是合法的标识符。'$' 和 '?' 
  不能在标识符里出现, 故而'A$?' 是非法的标识符。</p>
  </div><div id="hint3div" style="display:'none'"><p>正确答案是: 1, 2, 5</p>
  </div><p>对标识符的<a href="javascript:show(exp)">进一步回顾</a>:</p>
  <div id="expdiv" style="display:'none'"><p>标识符的长度可以是 1, 或 1 
  以上。标识符的第一个字符必须是英文字母或<br>
  划线 '_' , 而其后的字符应该是字母, 数字或下划线 '_'。保留字不可以用作为标识符。<br>
  作为其它的例子:<br>
  &nbsp;&nbsp;&nbsp; count, test23, high_balance 是正确的标识符。<br>
  &nbsp;&nbsp;&nbsp; I count, hi!there, high-balance 是不正确的标识符。</p>
  </div>
</blockquote>

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

⌨️ 快捷键说明

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