Question: C. A structure pointer Just like you can define a pointer of a standard data-type such as an int or a double, you can also
C. A structure pointer
Just like you can define a pointer of a standard data-type such as an int or a double, you can also define a pointer of programmer defined data-type (which is a struct). The syntax is identical. struct_name *struct_pointer_name; Remember that to access a structure member using a pointer, you have use the -> operator. For example, struct_pointer_name->struct_member_name In this program, we will define a structure and a structure pointer, do some operations on the members using the pointer. Using this template to start your code
#include
struct Employee {
string name; int experience; double bonus; }
int main() {
} ~
Update the provided code as follows Declare an Employee pointer and assign dynamic memory to it. Using a suitable message, prompt the user to enter value for name and number of years of experience for the employee. Calculate the bonus for the employee using the following criterion. o If years of experience is greater than 10, bonus is 5000.00. o Otherwise, bonus is 3000.00. Display the name of and the bonus earned by the employee using a suitable message. Delete the structure pointer.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
