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

📄 c83_31.htm

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

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>练习题一 </title>
<script language="javascript">

	function init(){
		a1=a1div.style;
		a2=a2div.style;
		a3=a3div.style;
	}
	function show(obj){
		obj.display='';
	}
	function hide(obj){
		obj.display='none';
	}

	function judge(){
		var i=document.form.T1.value;
		if(i==1){
			hide(a2);
			hide(a3);
			show(a1);
		}else if(i==2){
			hide(a1);
			hide(a3);
			show(a2);
		}else if(i==3){
			hide(a1);
			hide(a2);
			show(a3);
		}
	}	
</script>
</head>

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

<blockquote>
  <table border="0" width="550" height="181">
    <tr>
      <td width="50%" height="175"> <p>我们想定义一个位段, 它满足下面的要求:<ol>
        <li>a 有两位</li>
        <li>b 有两位</li>
        <li>c 有两位</li>
        <li>d 有四位</li>
      </ol>
      <p>在右边三个程序中, 哪些是符合这种要求的?</p>
      <form name="form">
        <p><input type="text" name="T1" size="4"><input type="button" value="Enter" name="B1"
        onClick="judge()"></p>
      </form>
      </td>
      <td width="50%" height="175"><table>
        <tr>
          <th width="614" bgcolor="#FF9933">1</th>
        </tr>
        <tr>
          <td ALIGN="center" width="614" bgcolor="#00FFFF"><p align="left">struct bitfields1<br>
          {<br>
          &nbsp;&nbsp;&nbsp;&nbsp; unsigned a,b,c: 2;<br>
          &nbsp;&nbsp;&nbsp;&nbsp; unsigned d : 4;<br>
          }</td>
        </tr>
        <tr>
          <th width="614" bgcolor="#FF9933">2</th>
        </tr>
        <tr>
          <td ALIGN="center" width="614" bgcolor="#00FFFF"><p align="left">struct bitfields2<br>
          {<br>
          &nbsp;&nbsp;&nbsp;&nbsp; unsigned a:2, b:2;<br>
          &nbsp;&nbsp;&nbsp;&nbsp; unsigned c:2, d:4;<br>
          }</td>
        </tr>
        <tr>
          <th width="614" bgcolor="#FF9933">3</th>
        </tr>
        <tr>
          <td ALIGN="center" width="614" bgcolor="#00FFFF"><p align="left">struct bitfields3<br>
          {<br>
          &nbsp;&nbsp; &nbsp; unsigned a,b,c: 6;<br>
          &nbsp;&nbsp;&nbsp;&nbsp; unsigned d: 4;<br>
          }</td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
  <p><br>
  </p>
  <div id="a1div" style="display:'none'"><font color="#FF0000"><p>错误!</font>与此等价的说明是:<br>
  unsigned a;<br>
  unsigned b;<br>
  unsigned c: 2;<br>
  unsigned d: 4;<br>
  <br>
  </p>
  </div><div id="a3div" style="display:'none'"><font color="#FF0000"><p>错误!</font>与此等价的说明是:<br>
  unsigned a;<br>
  unsigned b;<br>
  unsigned c: 6;<br>
  unsigned d: 4;</p>
  </div><div id="a2div" style="display:'none'"><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 + -