Basic computer programming discussion forum post help
Basic computer programming discussion forum post help
Please provide 2 to 3 paragraphs on the below topic AND replies to the 2 below peer posts:
Describe how to pass a structure variable to a procedure and also how to store a structure variable in an array. Provide an example of each to demonstrate your understanding. Then, in your response posts, provide constructive critiques of the examples provided by your classmates. After your initial post, be sure respond to at least two peers in this discussion.
Peer Post 1:
To begin the process of passing a structure variable to a procedure you must first declare your structure variables:
Public Structure foodPrice
Public cheeseBurger As Decimal
Public frenchFries As Decimal
Public softDrink As Decimal
End Structure
Structure variables, however, cannot be initialized within the structure declaration. When passing a structure into a procedure, it is acheived by declaring elements to be of that structure type. For example:
Public Sub populateMenu(ByRef currentPrice As foodPrice)
currentPrice.cheeseBurger = burgerCost.Text
currentPrice.frenchFries = friesCost.Text
currentPrice.softDrink = drinkCost.Text
End Sub
Assuming that the application contains the necessary text box controls for the input of food prices, this procedure would use the foodPrice structure to assign values to these elements.
In order to store a structure variable as an array the array declaration can be nested within the structure declaration:
Public Structure drinkMenu
Public drinkFlavors() As String
End Structure
Values can then be assigned to the array elements and the structure variable drinkFlavor will be stored as an array.
Peer Post 2:
Structure variables contains varieties of members and they are usually variable. It can be passed to a procedure or stored in an array. Passing a structure variable to a procedure, all of it members are passed automatically. The procedure uses structure variables to store the input items then store each input items on its corresponding members. One of the main advantages of the structure is the convenience and reliability so the programmer do not have to calculate the offsets of each member. Declaring an array, using the structure as the array’s data type. In a program, its better to intialize an array by setting it equal to the values you wish to intialize the array to enclose on brackets separated by commas.
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


