Additional Activities
附加练习
Here's some more practice for you. If you get really stuck, look in EVERYONE\CH05 for the solutions.
这里为你准备了一些练习。如果遇到障碍,请到EVERYONE\CH05中去寻找解决方法。
Activity 5-3: Find the Average
练习5-3:求平均值
Create a subVI that averages three input numbers and outputs the result (see Figure 5.33). Remember to create both the icon and connector for the subVI. Save the VI as Find the Average.vi.
创建一个subVI对3个输入的数值求平均值,并输出结果(见图5.33)。不要忘记给subVI创建图标和连接器。将这个VI保存为Find the Average.vi。
Figure 5.33. Find the Average.vi front panel

Activity 5-4: Divide by Zero (Who Says You Can't?)
练习5-4:用0做除法(谁说你不能?)
Build a VI that generates a random number between zero and ten, and then divides it by an input number and displays the result on the front panel (see Figure 5.34). If the input number is zero, the VI lights an LED to flag a "divide by zero" error. Save the VI as Divide by Zero.vi.
创建一个VI,产生一个0到10之间的随机数,用一个输入的数来除这个随机数,并将结果显示在前面板上(见图5.34)。如果输入的数字是0,VI点亮一个LED灯并产生一个“divide by zero”的错误信息。将这个VI保存为Divide by Zero.vi。
Figure 5.34. Divide by Zero.vi front panel


Use the Equal? Function found in the Comparison subpalette of the Functions palette.
使用Functions面板Comparison子面板中的Equal?函数。


