Write a
20 30 4 20 30 30 −1 |
Then the output should be:
Number of 4's: 1 Number of 20's: 2 Number of 30's: 3 |
Want to see the full answer?
Check out a sample textbook solutionChapter 9 Solutions
Problem Solving With C++ (Looseleaf) - With Access
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Digital Fundamentals (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- A university uses student numbers consisting of 6 digits plus a check digit in the 7th position. The check digit is found by taking the number formed by the first 6 digits modulo 7. A transposition in this setup is a switch of two adjacent digits - check digit excluded. Which transpositions of a student number (a6,a5,a4,a3,a2,a1,a0) (here written as a vector, with check digit a0) will not be detected by the check digit? Explain your answer in full and show any calculations you do. Hint: Note that the value of any ai in the number is ai×10i and consider the difference between the values of the correct and incorrect numbers modulo 7.arrow_forwardRead integers from input and store each integer into a vector until -1 is read. Do not store -1 into the vector. Then, output the values in the vector that are less than the last value in the vector, each on a new line. Ex: If the input is 26 -98 -39 -14 -1, the output is: -98 -39arrow_forwardWrite a function that takes a vector of integers, an integer n representing the number of elements in that vector, and an integer b. Implement the sequential search algorithm to look for the integer b in the vector. The sequential search works as follows: you must look at all the elements of the vector until you find the b, from the first to the last. The function must return an integer representing how many elements the function tested until it found b. If it does not find the function, it must return 0. The name of the function must be called "busca_seq". Program in C.arrow_forward
- We initialize the parameters to all zero values and run the linear perceptron algorithm through these points in a particular order until convergence . The number of mistakes made on each point are shown in the table below . ( These points correspond to the data point in the plot above ) 00 = Note : You should be able to arrive at the answer without programming . What is the resulting offset parameter 00 ? Enter the numerical value for 00 : 0 Label Coordinates Perceptron mistakes - What is the resulting parameter ? ( Enter as a vector , e.g. type [ 0,1 ] if = [ 01 ] . ) -1 -1 -1 -1 -1 +1 +1 +1 +1 +1 ( 0,0 ) ( 2,0 ) ( 3,0 ) ( 0,2 ) ( 2,2 ) ( 5,1 ) ( 5,2 ) ( 2,4 ) ( 4,4 ) ( 5,5 ) 19 10 5 9 11 0 3 1 1 STANDARD NOTATIONarrow_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_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)arrow_forward
- In PYTHON Write a function that prints multiple times a vector from its first element up to the next occurrence of an element having value equal to a provide number Each print stops at the i-th occurrence of the provided number Use while loop(s) Function Name:vec_multi_print_to_number Parameters:a_vector,a_value Return:none Example: Input:my_vector=[5,6,7,8,9,5,6,7,8,9] Invokefunction:print_up_to_value(my_vector,7) Output:[5,6,7,8,9,5,6,7]arrow_forwardWrite a function that removes duplicates from a vector. For example, if remove duplicates is called with a vector containing 1 4 9 16 9 7 4 9 11 (use these numbers) then the vector is changed to 1 4 9 16 7 11arrow_forwardGiven two arrays A and B of equal size N, the task is to find a vector containing only those elements which belong to exactly one array - either A or B - but not both. That is, if some element x appears in both A and B it should not be included in the output vector. Complete the implementation of "getVector(vector<ll>A, vector<ll>B, int N)" function. Example: Input: 1 3 5 7 1 3 2 4 6 7 8 Output: 3 5 1 3 2 4 6 8 The driver codes are attached in the images below. DO NOT CHANGE THE PROVIDED DRIVER CODES AT ALL, LEAVE THEM EXACTLY THE SAME. ONLY ADD CODE TO THE "getVector(vector<ll>A, vector<ll>B, int N)" FUNCTIONarrow_forward
- A vector contains the grades obtained by students of a class in an assessment, with the following characteristics: Notes are actual values between zero and ten.If the value is equal to -1.0, then this means that the student has missed the assessment.The average approval rate at this University is 6 (six).Write a program that reads two vectors: the note vector described and a vector containing the students' names of the same size. As an output, print the following information in the console in this order: How many students missed the evaluation?How many students have been approved?Among the students present, how many students failed?Among the students present, what was the average grade, with up to two decimal places of accuracy?What's the name of the student who got the highest grade in the class?TipsCreate different counters to find the value of outputs 1 through 4. These counters are different from the loop counter that traverses the vector;Within the while loop, use five independent…arrow_forwardcan you please solve the question and make it in the right format so that I can copy and paste it? Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words. Ex: If the input is: 5 hey hi Mark hi mark the output is: hey 1 hi 2 Mark 1 hi 2 mark 1 Hint: Use two vectors, one vector for the strings and one vector for the frequencies. 272772.1571588arrow_forwardIn C++ write a program that takes user input from consoles for integers. Enter a negative value to end input. Use vectors and calculate a histogram of the values entered. Use bins of size ten and output the histogram as bins and the number of values that fall in each bin.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr