CST 180: Structured Data Worksheet Name:______

1. Write a structure declaration to hold the following data about a savings account:

Account Number (15 character string)

Account Balance (double)

Interest Rate (double)

Average Monthly Balance (double)

2. Write a definition statement for a variable of the structure you declared in question 1. Initialize the members with the following data:

Account Number: ACZ42137-B12-7

Account Balance: $4512.59

Interest Rate: 4%

Average Monthly Balance: $4217.07

For questions 3 through 6 below, assume the Product structure is declared as follows:

struct Product

{

char description[50]; // Product description

int partNum; // Part Number

double cost; // Product cost

};

3. Write a definition for an array of 100 Product structures. Do not initialize the array.

4. Write a loop that will step through the entire array you defined in question 3, setting all the product descriptions to a null string, all part numbers to zero, and all costs to zero.

5. Write the statements that will store the following data in the first element of the array you defined in Question 3.

Description: Claw Hammer

Part Number: 547

Part Cost: $8.29

6. Write a loop that will display the contents of the entire array you created in Question 3.

7. Is it possible for a structure variable to be a member of another structure variable? Yes______No______

8. Can structure variables be passed as arguments to functions?

Yes______No______

9. Can a function return a structure?

Yes______No______

10. If you wanted to modify a structure inside a function, which would you use?

Pass By Value______Pass by Reference______

11. How should handle passing large structures to a function? Why?______

______