📄 c73_42.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>练习题二 </title>
<script language="javascript" src="../../layer_obj.js"></script>
<script language="javascript">
layername="name";
content=" ";
createLayer(layername,400,350,200,100,true,content);
function showandplay(str){
replaceContent(layername,str);
moveLayer(layername,400,350);
showLayer(layername);
slideLayer(layername,400,370,200);
setTimeout("hideLayer(layername)",3000);
}
var con;
function judge(i){
if(i==1){
s=document.form.in8.value;
if(s=="See you at the snack bar.")
con="答案正确!";
else con='<font color="#FF0000">答案错误!</font>再试一次!';
showandplay(con);
}
else if(i==2){
s=document.form.in9.value;
if(s=="ee you at the snack bar.")
con="答案正确!对于前缀 ++ 操作符, ptr 的值在自增一之后再作为函数 puts 的参数。";
else con='<font color="#FF0000">答案错误!</font>再试一次!';
showandplay(con);
}
else if(i==3){
s=document.form.in11.value;
if(s=="See you")
con="答案正确!数组 note 的第八个元素在做完第十行后已变为空字符, 所以 note 开头的字符串将以第八个元素结束。";
else con='<font color="#FF0000">答案错误!</font>再试一次!';
showandplay(con);
}
else if(i==4){
s=document.form.in12.value;
if(s=="e you")
con="答案正确!";
else con='<font color="#FF0000">答案错误!</font>再试一次!';
showandplay(con);
}
}
</script>
</head>
<body bgcolor="#ccefcc">
<blockquote>
<p>下面的程序将输出四个字符串, 先读懂它。</p>
<div align="center"><center><table border="6" width="442" cellspacing="0" cellpadding="6" height="150" bordercolor="#FF9933">
<tr>
<th width="666" bgcolor="#FF9933">程序</th>
</tr>
<tr>
<td ALIGN="center" width="666" bgcolor="#00FFFF"><p align="left">1.#include
<stdio.h><br>
2.main()<br>
3.{<br>
4. static char note[]="See you at the snack bar.";<br>
6. char *ptr;<br>
7. ptr = note;<br>
8. puts(ptr);<br>
9. puts(++ptr);<br>
10.note[7] = '\0';<br>
11.puts(note);<br>
12.puts(++ptr);<br>
13.}</td>
</tr>
</table>
</center></div><p><font color="#FF0000">问题</font>:它将打印出什么?</p>
<p> </p>
<p> </p>
<form name="form">
<table border="0" width="571">
<tr>
<td width="567">请填写执行第 8 句的输出:<input type="text" name="in8" size="30"><input type="button" value="Enter" name="B1" onClick="judge(1)"></td>
</tr>
<tr>
<td width="567">请填写执行第 9 句的输出:<input type="text" name="in9" size="30"><input type="button" value="Enter" name="B2" onClick="judge(2)"></td>
</tr>
<tr>
<td width="567">请填写执行第 11 句的输出:<input type="text" name="in11" size="30"><input type="button" value="Enter" name="B3" onClick="judge(3)"></td>
</tr>
<tr>
<td width="567">请填写执行第 12 句的输出:<input type="text" name="in12" size="30"><input type="button" value="Enter" name="B4" onClick="judge(4)"></td>
</tr>
</table>
</form>
<p align="center"><a href="javascript:close()">关闭</a></p>
</blockquote>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -