<< Chapter < Page Chapter >> Page >
A screen capture of a window with a grey grid enclosing two input or output boxes, labeled year, and message. A pop-out menu from the year box is visible, with the selection, representation, then word, then an object labeled I32 highlighted.
32-Bit Integer Numeric

Arrange the Year and Message terminals in the Block Diagram window as shown in the figure.

A three-part diagram connecting numbers to operations. The first is the number 4 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. The second is the number 100 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, not equal to 0. The third is the number 400 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. In between the first and second parts is the, and, operator. In between the second and third parts is the, or, operator. To the right of these diagrams is a large rectangle, containing a drop-down menu labeled False. Inside the box is a pink rectangle containing the text, Is a Leap Year. To the far left of the diagrams is an object titled year, and to the far right is an object titled message.
Unwired Leap Year Diagram

Wire the OR operator is to the “?” in the case structure and the string constant “Is not a Leap Year” is wired to Message .

A three-part diagram connecting numbers to operations. The first is the number 4 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. The second is the number 100 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, not equal to 0. The third is the number 400 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. In between the first and second parts is the, and, operator. In between the second and third parts is the, or, operator. To the right of these diagrams is a large rectangle, containing a drop-down menu labeled False. Inside the box is a pink rectangle containing the text, Is a Leap Year. To the far left of the diagrams is an object titled year, and to the far right is an object titled message. There are blue lines connecting year to each quotient and remainder operator, green lines connecting the operators together, then converging on a connector from the or operator to the large rectangle. Finally, there is a pink line connecting the large rectangle to an icon labeled, message.
Leap Year False Case

Select the True option and Wire the “Is a Leap Year” string constant to the output terminal of the Case Structure .

A three-part diagram connecting numbers to operations. The first is the number 4 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. The second is the number 100 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, not equal to 0. The third is the number 400 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. In between the first and second parts is the, and, operator. In between the second and third parts is the, or, operator. To the right of these diagrams is a large rectangle, containing a drop-down menu labeled True. Inside the box is a pink rectangle containing the text, Is a Leap Year. To the far left of the diagrams is an object titled year, and to the far right is an object titled message. There are blue lines connecting year to each quotient and remainder operator, green lines connecting the operators together, then converging on a connector from the or operator to the large rectangle. Finally, there is a pink line connecting the large rectangle to an icon labeled, message.
Leap Year True Case

Save the program as Leap Year.vi , enter Year values and run the program to determine whether the value of Year is that of a leap year or not.

A screen capture of a grey grid containing an input and output box. The input box is labeled, year, and contains the value 2000. The output box is labeled, Message, and contains the text, is a leap year.
Leap Year Program

Arrays

Right click on the Front Panel window and select Array from the Controls>>Modern>>Arrays, Matrix&Cluster menu, and drop an array onto the Front Panel window. The array structure consists of an index or element offset (left portion of the structure) and the array elements (right portion of the structure). When the array structure is placed on the Front Panel window, the data type of the array is undefined as indicated by the grayed out portion of the array.

A two-part screenshot. The left side is a grey grid containing one white box, containing the value 0, and one larger grey box, labeled Array. The right side is a window titled, controls, containing a hierarchical list, beginning with Modern, and continuing with Array, matrix, and cluster. Below the list are two objects, labeled Array and Cluster.
Arrays

To define the array data type, drag and drop a data type onto the array structure. For instance, to create an input array of numbers, place Numeric Control into the array structure.

A two-part screenshot. The left side is a grey grid containing one white box, containing the value 0, and one larger grey box, labeled Array. Inside the grey box are dashed rectangles of different heights and widths. The right side is a window titled, controls, containing a hierarchical list, beginning with Modern, and continuing with Array, matrix, and cluster. Below the list are two objects, labeled Array and Cluster.
Creating a Numeric Array

At this point, the numeric array is an Empty or Null array because no elements of the array have been defined. This is indicated by the grayed out numeric control within the array structure.

A screen capture of a grey grid containing an input and output box. Both boxes contain values of 0, and the box is titled, Numeric Input Array.
Empty Numeric Array

Define elements of an input array by selecting the offset and entering its value. For instance, at offset = 4, enter the value 0.0. This defines Numeric Input Array as {0, 0, 0, 0, 0} .

A screen capture of a grey grid containing an input and output box. The box is titled, Numeric Input Array. The input box contains the value, 4, and the output box contains the value, 0.
Defining Numeric Array Elements

An output array is created similarly to an input array with the exception that an output data type needs to be dropped into the array structure.

A screen capture of a grey grid containing four boxes. The left two boxes are titled, Numeric Input Array. The right two boxes are titled, Numeric Output Array. All four boxes contain the value, 0.
Creating Output Numeric Arrays

For loop

This program converts an array of Fahrenheit values to Celsius. Create numeric input and output arrays and label them Fahrenheit and Celsius respectively. In the Fahrenheit array enter the values 0, 20, 40, 60, 80, 100, 120, 140, 160, 180 and 200 at offsets 0 through 10 as shown in [link] .

A screen capture of a grey grid containing four boxes. The left two boxes are titled, Fahrenheit, and the right two boxes are titled, Celsius. The leftmost box under fahrenheit contains the value, 10, and the right box under fahrenheit contains the value, 200. Both boxes under celsius contain the value, 0.
Numeric Input and Output Arrays

Right click in the Block Diagram window, navigate to Programming>>Structures and click on For Loop .

A screen cap of a window containing a directory hierarchy 'Programming' above 'Structures'. Contained in 'Structures' are two icons. On the left of the window there is an orange icon labeled 'Fahrenheit'.
For Loop Structure

Click and drag to create the For Loop as shown in [link] and [link] .

A dashed square is in the middle of this image. There is a smal dashed square containing an 'N'in the lower right corner of the square. On the left side of the square is an icon labeled 'Fahrenheit' and on the right side there is a similar icon labeled Celsius.
Creating For Loops
A dashed square is in the middle of this image. There is a smal dashed square containing an 'N'in the lower right corner of the square. On the left side of the square is an icon labeled 'Fahrenheit' and on the right side there is a similar icon labeled 'Celsius'.
For Loop

Right click inside the For Loop and select Select a VI… from the pop-up menu. Find the Fahrenheit to Celsius.vi and click OK . Drop the function inside the For Loop .

From left to right there is an orange square labeled 'Fahrenheit' and then a big box with a blue box 'N' on the upper left corner and a blue box 'i' on the lower left corner. In the middle of the big box there is a small box containing 'Fahr to Celsius'. On the right side of the big box there is another icon labeled 'celsius'.
Function in Diagram

To complete the program, wire the Fahrenheit input array to the input terminal of the Fahrenheit to Celsius function and wire the output terminal of the Fahrenheit to Celsius function to the Celsius output array.

From left to right there is an orange square labeled 'Fahrenheit' and then a big box with a blue box 'N' on the upper left corner and a blue box 'i' on the lower left corner. In the middle of the big box there is a small box containing 'Fahr to Celsius'. On the right side of the big box there is another icon labeled 'celsius'. An orange line runs from the right edge of the left icon through the center of the big box and connects to the left side of the right icon.
Wired Function in Diagram

This program uses the For Loop to select each element in the Fahrenheit input array, converts that value to Celsius and saves the results in the Celsius output array. Save the program as Fahrenheit to Celsius For Loop.vi and run the program.

Two parallel forms. On the left there is form labeled 'Fahrenheit' with the values '7' and '140'. On the right is another form labeled 'Celsius' with the values '7' and '60'.
Fahrenheit to Celsius Arrays

Questions & Answers

explain and give four Example hyperbolic function
Lukman Reply
The denominator of a certain fraction is 9 more than the numerator. If 6 is added to both terms of the fraction, the value of the fraction becomes 2/3. Find the original fraction. 2. The sum of the least and greatest of 3 consecutive integers is 60. What are the valu
SABAL Reply
1. x + 6 2 -------------- = _ x + 9 + 6 3 x + 6 3 ----------- x -- (cross multiply) x + 15 2 3(x + 6) = 2(x + 15) 3x + 18 = 2x + 30 (-2x from both) x + 18 = 30 (-18 from both) x = 12 Test: 12 + 6 18 2 -------------- = --- = --- 12 + 9 + 6 27 3
Pawel
2. (x) + (x + 2) = 60 2x + 2 = 60 2x = 58 x = 29 29, 30, & 31
Pawel
ok
Ifeanyi
on number 2 question How did you got 2x +2
Ifeanyi
combine like terms. x + x + 2 is same as 2x + 2
Pawel
Mark and Don are planning to sell each of their marble collections at a garage sale. If Don has 1 more than 3 times the number of marbles Mark has, how many does each boy have to sell if the total number of marbles is 113?
mariel Reply
Mark = x,. Don = 3x + 1 x + 3x + 1 = 113 4x = 112, x = 28 Mark = 28, Don = 85, 28 + 85 = 113
Pawel
how do I set up the problem?
Harshika Reply
what is a solution set?
Harshika
find the subring of gaussian integers?
Rofiqul
hello, I am happy to help!
Shirley Reply
please can go further on polynomials quadratic
Abdullahi
hi mam
Mark
I need quadratic equation link to Alpa Beta
Abdullahi Reply
find the value of 2x=32
Felix Reply
divide by 2 on each side of the equal sign to solve for x
corri
X=16
Michael
Want to review on complex number 1.What are complex number 2.How to solve complex number problems.
Beyan
yes i wantt to review
Mark
use the y -intercept and slope to sketch the graph of the equation y=6x
Only Reply
how do we prove the quadratic formular
Seidu Reply
please help me prove quadratic formula
Darius
hello, if you have a question about Algebra 2. I may be able to help. I am an Algebra 2 Teacher
Shirley Reply
thank you help me with how to prove the quadratic equation
Seidu
may God blessed u for that. Please I want u to help me in sets.
Opoku
what is math number
Tric Reply
4
Trista
x-2y+3z=-3 2x-y+z=7 -x+3y-z=6
Sidiki Reply
can you teacch how to solve that🙏
Mark
Solve for the first variable in one of the equations, then substitute the result into the other equation. Point For: (6111,4111,−411)(6111,4111,-411) Equation Form: x=6111,y=4111,z=−411x=6111,y=4111,z=-411
Brenna
(61/11,41/11,−4/11)
Brenna
x=61/11 y=41/11 z=−4/11 x=61/11 y=41/11 z=-4/11
Brenna
Need help solving this problem (2/7)^-2
Simone Reply
x+2y-z=7
Sidiki
what is the coefficient of -4×
Mehri Reply
-1
Shedrak
the operation * is x * y =x + y/ 1+(x × y) show if the operation is commutative if x × y is not equal to -1
Alfred Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Introduction to g programming. OpenStax CNX. Mar 15, 2010 Download for free at http://cnx.org/content/col11192/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to g programming' conversation and receive update notifications?

Ask