Write a single statement or a set of statements to accomplish each of the following:

a) Define a structure called Part containing int variable partNumber and char array part-Name, whose values may be as long as 25 characters.
b) Define PartPtr to be a synonym for the type Part *.
c) Use separate statements to declare variable a to be of type Part, array b[ 10 ] to be of type Part and variable ptr to be of type pointer to Part.
d) Read a part number and a part name from the keyboard into the members of variable a.
e) Assign the member values of variable a to element three of array b.
f) Assign the address of array b to the pointer variable ptr.
g) Print the member values of element three of array b, using the variable ptr and the structure pointer operator to refer to the members.

a) ```
struct Part
{
int partNumber;
char partName[ 26 ];
}; // end struct Part
```
b) ```
typedef Part * PartPtr;
```
c) ```
Part a;
Part b[ 10 ];
Part *ptr;
```
d) ```
cin >> a.partNumber >> a.partName;
```
e) ```
b[ 3 ] = a;
```
f) ```
ptr = b;
```
g) ```
cout << ( ptr + 3 )->partNumber << ' '
<< ( ptr + 3 )->partName << endl;
```

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. The ticket-granting ticket is encrypted with a secret key known only to the AS and the TGS. 2. The ticket-granting ticket is not reusable. 3. Kerberos does not support interrealm authentication. 4. X.509 provides a format for use in revoking a key before it expires. 5. Because serial numbers are unique within a CA, the serial number is sufficient to identify the certificate.

Computer Science & Information Technology

________ involves reworking programs to make them clearer and easier to maintain while preserving their correctness and functionality.

a. Object-oriented programming b. Refactoring c. Agile software development d. LAMP

Computer Science & Information Technology