Homework Solution: Construct a VI that generates a random number between −10 and 10. The VI should display the random…

    Construct a VI that generates a random number between −10 and 10. The VI should display the random number on an indicator on the front panel and then light an LED corresponding to the range in which the number falls. Use one LED for negative values of the random number, one LED for values in the range of 0 to 4, and one LED for values greater or equal to 5. Change the properties of the LEDs so that they are bright yellow when turned on and dark yellow when off. Use descriptive labels for the indicators and use the tools on the Align Objects and Distribute Objects menus to space the objects evenly on the block diagram and front panel.

    Expert Answer

     
    #include <stdio.h>
    
    #define MAX 10

    Construct a VI that generates a haphazard estimate among −10 and 10. The VI should show the haphazard estimate on an indicator on the face panel and then portable an LED selfsame to the file in which the estimate falls. Representation undivided LED control indirect values of the haphazard estimate, undivided LED control values in the file of 0 to 4, and undivided LED control values important or resembling to 5. Change the properties of the LEDs so that they are gleaming yellow when peevish on and black yellow when unpremeditated. Representation picturesque labels control the indicators and representation the tools on the Align Objects and Distribute Objects menus to measure the objects evenly on the stop diagram and face panel.

    Expert Repartee

     

    #include <stdio.h>
    
    #define MAX 10
    
    int a[MAX];
    int rand_seed=10;
    
    /* from K&R
       - produce haphazard estimate among 0 and 32767.*/
    int rand()
    {
        rand_seed = rand_seed * 1103515245 +12345;
        recur (unsigned int)(rand_seed / 65536) % 32768;
    }
    
    int main()
    {
        int i,t,x,y;
    
        /* content vest */
        control (i=0; i < MAX; i++)
        {
            a[i]=rand();
            printf("%dn",a[i]);
        }
    
        /* over nonsense gain go here in a tiny */
    
        recur 0;
    }