Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write a C++
- stores 16 integer random numbers in a
vector container V.- The random numbers range in value (0 – 199). One can generate such numbers by invoking the random number generation function, rand( ) and using the % (mod)operator
- Prior to using the rand( ) function, initialize the random number generator with the srand(17)
- Print the entire vector after filling the vector container V
- Create a function Total(vector iterator, Size) that returns the total sum of the vector V
- Count the number of values exceeding 85 and print the result
- Remove all numbers from the vector V that are divisible by 3
- Print the entire modified reduced vector after the removal step
- Create a set S(descending order) from the modified vector V
- Print Set S
- Remove the first number in S that is divisible by 4
- Print modified Set S
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 5 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write in C++ Please and Thank you. Write a program that gets a list of integers (which are chosen from values between 0 and 8 inclusive) from the user, and stores the factorial of each integer in a vector. The first integer indicates how many numbers are in the list and should not be stored in the vector. The program should print out the vector values. For example, given the following input: 5 1 2 3 0 4 The first number, 5, means there will be 5 numbers in the vector and we are going to store the factorials of the remaining numbers. Therefore, the following output will be produced: 1 2 6 1 24 which is the result of 1!, followed by 2!, then 3!, 0!, and finally 4!arrow_forwardWrite a function named mean that accepts as a parameter a reference to a vector of real numbers, and returns the arithmetic mean (average) of the integers in the vector as a real number. For example, if the vector passed contains {2.0, 4.5, 6.5, 1.0}, your function should return 3.5. If the vector is empty, return 0.0. Do not modify the vector that is passed in.arrow_forwardHelp me structure a program in C++ that opens a file for read. Then reads the data in from the file and calculates the sum of the row values. The data is all integers with 7 values per line, and 10 lines of data in the file. The program must use two functions, one to open the file, and another to output and calculate the sum of the row values. All data must be read into a two dimensional array first, then the data is output and the sum calculated. The data should be printed out by row, along with the sum of the row values. Prototypes to be used: void rowSumCalculator( int myArray[][10], int rowCount, int colCount );Function rowSumCalculator( ) writes out the data in the array and the sum of the values in the row. void openFile( ifstream& infile, string prompt );Function openFile should print the prompt out to the user, read in the filename and open the file. If the file does not open, an error is written to the display, and the user prompted again. The function doesnot return until…arrow_forward
- Define a function named GetWordFrequency that takes a vector of strings and a search word as parameters. Function GetWordFrequency() then returns the number of occurrences of the search word in the vector parameter (case insensitive). Then, write a main program that reads a list of words into a vector, calls function GetWordFrequency() repeatedly, and outputs the words in the vector with their frequencies. The input begins with an integer indicating the number of words that follow. Ex: If the input is: 5 hey Hi Mark hi mark the output is: hey 1 Hi 2 Mark 2 hi 2 mark 2 Hint: Use tolower() to set the first letter of each word to lowercase before comparing. The program must define and use the following function:int GetWordFrequency(vector<string> wordsList, string currWord)arrow_forwardUsing C++ Programming language: Assume you define a vector in the following way: vector<int> vec; Assign the value 10 to the first element of this vector. What is the statement you would use?arrow_forwardWrite a function named cumulative that accepts as a parameter a reference to a vectorof integers, and modifies it so that each element contains the cumulative sum of the elements up through that index. For example, if the vector passed contains {1, 1, 2, 3, 5}, your function should modify it to store {1, 2, 4, 7, 12}.arrow_forward
- In matlab, Write a function that performs the data saturation operation, that is, if the values found within the vector exceed a certain limit value (in module), these values are equal to this limit value.arrow_forwardDefine a function named GetWordFrequency that takes a vector of strings and a search word as parameters. Function GetWordFrequency() then returns the number of occurrences of the search word in the vector parameter (case insensitive). Then, write a main program that reads a list of words into a vector, calls function GetWordFrequency() repeatedly, and outputs the words in the vector with their frequencies. The input begins with an integer indicating the number of words that follow. Ex: If the input is: 5 hey Hi Mark hi mark the output is: hey 1 Hi 2 Mark 2 hi 2 mark 2 Hint: Use tolower() to set the first letter of each word to lowercase before comparing. The program must define and use the following function:int GetWordFrequency(vector<string> wordsList, string currWord) write code in c++arrow_forwardWrite a C++ that Ask user to give you a list of the numbers and then Sort them, by calling two functions: Asc(Sort in Ascending order), and Desc(Sort in Descending order): Do the problem by vector, ask user to give you numbers and store them in the vector. then sort them, and also find the size of the vector. determine how many numbers were given by the user.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education