Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Create a program that manages a list of active users on a system. This could be an on-line game, web site, etc. This program

c++

Create a program that manages a list of active users on a system. This could be an on-line game, web site, etc.

This program should use Vectors instead of Arrays. If you use a FOR loop - use the Range-Based for loop ( pg 433 8th Ed - pg 439 9th Ed)

The program needs to provide a menu with the following options with working code to do these options:

1. Add a userName
2. List all userNames

3. Delete a userName

X. Exit.

Any invalid input for the menu will simply redisplay the menu.

Option 1 will prompt for a userName. An empty name will be ignored. The name will be added to the vector and the program menu is shown.

Option 2 will List all the users and their associated index. I.E

0 Billy444
1 Sue321
2. Eve001 Option 3 will prompt for an index number to delete. You may optionally show the result of option 2 when invoking option 3. The index number given for input needs to be tested to be within the range of possible values The deleting syntax is not covered in Chapter 7. There are at least 2 ways it can be done. 1. Assign the last entry to the element to be deleted, then issue a pop_back to remove the last entry. 2. Use the erase member function. This is listed in table 16-6 page 1012 - 8th edition or table 17-8 page 1041 9th edition. If "users" is the vector name, the syntax for using erase would be users.erase(users.begin() + indexToDelete); Option X should delete all entries in the vector and exit the program. See table 7-4 for the best Member function to do that. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions