Question: Write a program that uses an int pointer called hand to manipulate 3 variables: book, pencil, paper. You will use the hand pointer to

Write a program that uses an int pointer called hand to manipulate 3 variables: book, pencil, paper. You will 

Write a program that uses an int pointer called hand to manipulate 3 variables: book, pencil, paper. You will use the hand pointer to change the value of book, pencil, or paper based on USER INPUT. The value stored in each variable represents a location: //GLOBAL VARIABLES const int FLOOR = 1, CHAIR = 2, DESK = 3; For example, if hand is pointing to pencil, you could change the location of pencil using: *hand = FLOOR; Use the following functions: //ask the user which object to grab, then return a pointer to that object int* grab(int &book, int &pencil, int &paper); //ask the user where they would like to move the object void move(int* hand); //show the location of each object & contents of hand void showAll(int* hand, int &book, int &pencil, int &paper); //helper function for showAll, outputs the location of a single object. string show(int object); The whole program should loop and give the user the following options: 1) Show All 2) Grab Object 3) Move Object 4) Exit Program

Step by Step Solution

3.40 Rating (156 Votes )

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 Algorithms Questions!