Question
C++ Complete the copier simulation of How To 7.1 Working with Pointers Your program should first show the main menu: U)ser A)dministrator Q)uit For a
C++
Complete the copier simulation of How To 7.1 Working with Pointers
Your program should first show the main menu:
U)ser A)dministrator Q)uit
For a user, prompt for the ID and the number of copies, increment the appropriate account, and return to the main menu.
For an administrator, show this menu:
B)alance M)aster P)roject
In the balance option, show the balances of the master account and the ten project accounts. In the master option, prompt for a user ID and link it to the master account. In the project option, prompt for user and project IDs.
Afterward, return to the main menu.
Working with Pointers You use pointers because you want flexibility in your program: the ability to change the relationships between data. This How To walks you through the decision-making process for using pointers. Problem Statement We will illustrate the steps with the task of simulating a portion of the control logic for a departmental photocopier. A person making a copy enters a user number. There are 100 different users, with numbers 0 to er is linked to a copy account, either the master account or one of ten project accounts. That linkage is maintained by the administrator, and it can change as users work on different projects. When copies are made, the appropriate account should be incremented. Step 1 Draw a picture. Bartosz Liszkowski/Stockphoto. As described in Section 7.6, it is a good idea to draw a picture that shows the pointers in your program. In our example, we need to track the copy accounts: a master account and ten project accounts. For each user, we need a pointer to the copy account: Users identify themselves on the copier control panel. Using pointers, the relationships between users and copy accounts can be flexible. master_account - users - project accounts = Step 2 Declare pointer variables. This step is usually easy. With numerical data, you will have pointers of type int* or double. If you manipulate character arrays, you use char* pointers. In Chapter 10, you will use pointers to objects. How many pointer variables do you have? If you only have one or two, just declare variables such as double* account_pointer; If you have a sequence of pointers, use a vector or array, such as vectorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started