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;
```
You might also like to view...
The Simple Network Management Protocol contains ____ functions, which allow a device to send a message to the SNMP management console indicating that a certain threshold has been crossed, either positively or negatively.
A. log B. trap C. evidentiary packet dump D. e-mail message
You use the ____ function to find the total number of elements in an array.
A. sum() B. counta() C. count()
What is a data model? Discuss the main types of data models.
What will be an ideal response?
# and ## Operators
The # operator causes __________ to be converted to a __________. a) any preprocessor argument, user-defined type. b) a text token, string surrounded by quotes. c) a string, concatenated string. d) any float or int, string.