structs/arrays

1
2
3
4
5
6
7
8
9
10
11
12
13
struct SDate
{
	int month, day, year;
};
struct SMachineRec
{
	int idNumber;	
	string description;
	SDate purchaseDate;
	float cost;
	float payments[5];
};


Based on the structure definitions above, answer the questions below:
1. Does the above structure definitions occupy memory space?

2. Write statement to declare two variables of type SMachineRec, machine1, machine2.

3. Write statement(s) to assign 10085 to the idNumber, “desktop computer” to description, and 1287.5 to cost of machine1 that was declared in question #2.

4. Write statement(s) to assign 2/12/1998 to the purchase date of machine1 that was declared in question #2.

5. Write statement to assign machine1 to machine2.

6. Write the function prototype for a function that gets input for a SMachineRec and send back to its caller.


7. Write the function prototype for a function that displays information about a SMachineRec.

8. Write statement to create an array of 10 SMachineRec. Name the array machineList.

9. Write statement(s) to prompt and read in payments for all the machines on the machineList created in question #8.

10. Write statements to prompt and read in purchaseDate for all the machines on the machineList created in question #8.

Your homework, isn't it? Go ahead and do it. You will learn by doing.


Semantic note to the teacher: money does not float well.
Topic archived. No new replies allowed.