Question: In this exercise you will expand on a program by using the reference, and dereference operators to pass a structure instance by reference to a

 In this exercise you will expand on a program by using
the reference, and dereference operators to pass a structure instance by reference

In this exercise you will expand on a program by using the reference, and dereference operators to pass a structure instance by reference to a function and manipulate it. - Passing pointers to functions (5 pts) In pointers.cpp (see below) there is a prototype, and a call to a function to input the values into a Student instance. Note that the parameter to this function is the address of a structure instance . o Write the definition for this function at the bottom of the file. Don't forget to use the member selector operator for pointers (->) when you reference instance members in the function. e.g.: cin>>ptr->id; o You should enter student marks between o and 100 (no need to error check) o Make sure to include cin.ignore () before your getline function when asking for the name of the student. Compile and run this C++ program. (5 pts) Write a function that takes a reference to an instance of the Student structure and displays the contents. Here is the prototype: void print (Student &stud) o Call it from the main routine After you've done that, compile, link, and run again. At this point, your output should look something like this ease enter a name: Sam ease enter anid: 195556 ease enter a mark: 87 ease enter a mark: 88 ease enter a mark: 89 tudent info me: Sam d: 195556 ark o: 87 ark 1: 88 ark 2: 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!