Question

Write a complete C++ program that will: Declare a vector of integers Use a pointer to...

Write a complete C++ program that will:
Declare a vector of integers Use a pointer to dynamically allocate an array of 10 elements Ask the user how many values they would like to have in the data structures Read in the user’s response and make sure that it is greater than 20 (error loop) Generate the number of integers that the user asked for and store them into both data structures. The integer values should be unique unordered values (no duplicate values). Inside a loop: Present the user with a menu with the following choices: Output all values to the screen Add a new data value Remove a data value Sort the data Quit
Have the program perform the chosen menu option and then repeat the menu until the user chooses to quit.
Perform all operations (input, output, sort, add, remove) on both data structures.
Output: show 10 values per line with regular spacing
Add: ask the user for an integer value. search the data structure (either one) for that value if the value is NOT already in the data structures, then add it to both if the value is already in the data structures, do nothing
Remove: Ask the user for an integer value If the value is found in the data structures, remove it from both If the value is not currently in the data structures, do nothing
Sort: sort the data in both data structures from small to large
All of the major array operations must be done in functions. If vector operations take more than one or two lines, they should also be done in functions.
Name block and function comments are required as usual.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Write a complete C++ program that will: Declare a vector of integers Use a pointer to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Task 1 Main Function: Declare and fill an array with 1000 random integers between 1 -...

    Task 1 Main Function: Declare and fill an array with 1000 random integers between 1 - 1000. You will pass the array into functions that will perform operations on the array. Function 1: Create a function that will output all the integers in the array. (Make sure output is clearly formatted. Function 2: Create a Function that will sum and output all the odd numbers in the array. Function 3: Create a Function that will sum and output all the...

  • The name of the C++ file must be search.cpp Write a program that will read data...

    The name of the C++ file must be search.cpp Write a program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful. Read the values from the file and store into an integer array. The program should then prompt the user for an integer which will...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

  • In C++ write a simple menu program that displays a menu for the user in an...

    In C++ write a simple menu program that displays a menu for the user in an object-oriented technique. The menu should keep showing up until the user chooses to quit. Also, there is a sub-menu inside a menu. The user should get at least a line displayed after he or she chooses that particular option meaning if the user presses 1 for the read actors from the file. The output can look like "reading actors from a file" and then...

  • In C only Please! This lab is to write a program that will sort an array...

    In C only Please! This lab is to write a program that will sort an array of structs. Use the functions.h header file with your program. Create a source file named functions.c with the following: A sorting function named sortArray. It takes an array of MyStruct's and the length of that array. It returns nothing. You can use any of the sorting algorithms, you would like though it is recommended that you use bubble sort, insertion sort, or selection sort...

  • Using c++ 1 of 2 Assignment 5 Lab Section 3 write a program create a vector...

    Using c++ 1 of 2 Assignment 5 Lab Section 3 write a program create a vector with random numbers. Use merge sort to reorder the vector Prompt user to enter a number to search in the vector. If there are more than one number in the vector equal to the search value, display the indices remove the repeated numbers. If found just one matching number, display the index. If no matching number, prompt user for 2 options: add to the...

  • Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program...

    Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program that contains the following functions: 1. A function to read integer values into a one-dimensional array of size N. 2. A function to sort a one-dimensional array of size N of integers in descending order. 3. A function to find and output the average of the values in a one dimensional array of size N of integers. 4. A function to output a one-dimensional...

  • *Answer must be in C* Write a complete program as follows (declare any necessary variables): Create...

    *Answer must be in C* Write a complete program as follows (declare any necessary variables): Create an array of doubles named “hummus” with 2 rows and 300 columns. Initialize all array elements to zero. Write a loop that will repeatedly ask the user to enter a value and store it in the first row of the array (do not overwrite previously entered values) until the whole first row is populated with the user input. (hint the loop should have the...

  • c# Write compile and test a program named IntegerStatistics. The programs Main() method will: 1. Declare...

    c# Write compile and test a program named IntegerStatistics. The programs Main() method will: 1. Declare an array of 10 integers. 2. Call a method to interactively fill the array with any number of values (up to 10) until a sentinel value is entered. [If an entry is not an integer, continue prompting the user until an integer is entered.] When fewer than 10 integers are placed into the array, your statistics will be off unless you resize the array...

  • C programming Strictly - Write a program to sort an array of integers via arrays of...

    C programming Strictly - Write a program to sort an array of integers via arrays of pointers to those integers as shown in the figure. Problem 1 (68 points): Write a program to sort an array of integers via arrays of pointers to those integers as shown in the figure. The code should contain the following functions: 1)to randomly generate an array of integer numbers; 2) to allocate memory and build the arrays of pointers as shown in the figure...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT