a_6.1.htm

来自「建立《编译原理网络课程》的目的不仅使学生掌握构造编译程序的原理和技术」· HTM 代码 · 共 29 行

HTM
29
字号
<html>
<head>
<title>6.1的解答</title>
</head>
<body background="../../images/background.gif">
<center><font class="title2"><b>练习6.1</b></font></center><br>
<p>解答:</p>
<p>在下面的程序中,a和b的每一次出现处的下标和所应用的说明的下标一致:</p>
<p>
        &nbsp;&nbsp;&nbsp; <font size="4">program a<b><sub>1</sub></b>(input,output); <br>       
        &nbsp;&nbsp;&nbsp; procedure b<b><sub>1</sub></b>(u,v,x,y: integer); <br>        
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var a<sub><b>2</b></sub>: record a<sub><b>3</b></sub>,b<sub><b>2</b></sub>: integer 
end; <br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b<sub><b>3</b></sub>: record b<sub><b>4</b></sub>,a<sub><b>4</b></sub>:         
        integer end; <br>       
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;begin <br>       
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with a<sub><b>2</b></sub> do begin         
        a<sub><b>3</b></sub>:=u;b<sub><b>2</b></sub>:=v end; <br>       
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with b<sub><b>3</b></sub> do begin         
        a<sub><b>4</b></sub>:=x; b<sub><b>4</b></sub>:=y end; <br>       
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeln(a<sub><b>2</b></sub>. a<sub><b>3</b></sub>,a<sub><b>2</b></sub>.         
        b<sub><b>2</b></sub>,b<sub><b>3</b></sub>.a<sub><b>4</b></sub>,b<sub><b>3</b></sub>.b<sub><b>4</b></sub>) <br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end; <br>       
        &nbsp;&nbsp;&nbsp; begin <br>       
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;b<b><sub>1</sub></b>(1,2,3.4) <br>       
        &nbsp;&nbsp;&nbsp; end.</font></p>
</body>

<html><script language="JavaScript">

⌨️ 快捷键说明

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