C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
5.19 LAB: Word Frequencies
Write a
SAVE
AI-Generated Solution
info
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
to generate a solution
Click the button to generate
a solution
a solution
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
- Q1) A vector is given by x = [7,19,2,14,5,12,4,18,6,13]. Using conditional statements and loops, write a program that creates two vectors from xone (call it N) that contains the number of odd values and their average, and a second (call it T) that contains the number of even values and their median.arrow_forwardWrite a while loop to read positive integers from input until a non-positive integer is read. For each positive integer read before the non-positive integer, add the positive integer plus five to vector vect1. Ex: If the input is 9 1 2 8 -999, then the output is: 14 6 7 13 Note: Positive integers are greater than 0. 1 #include 2 #include 3 using namespace std; 4 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 } vector vect1; int value; int i; V* Your code goes here */ for (i = 0; i < vect1.size(); ++i) { cout << vect1.at (i) << endl; } return 0; Iarrow_forwardC Programming: 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. Each word will always contain less than 10 characters and no spaces. Ex: If the input is: 5 hey hi Mark hi mark Then, the output is: hey 1 hi 2 Mark 1 hi 2 mark 1 Hint: Use two arrays, one array for the strings and one array for the frequencies.arrow_forward
- use C++arrow_forwardData structure & Algorithum. Java Program Write code that accomplishes the following tasks. Consider two bags that can hold strings. One bag is named letters and contain seeral one-letter strings. The other bag is empty and is namedvowels. One at a time removed a string from letters. If the string contain a vowel place it into bag vowels, otherwise, discard the string. After you have checked all of the strings in letters, report the number of vowels and the number of times each vowels appears in the bag.arrow_forwardComputer Science C++ Write a program that: Gets a character array (C-string) using cin.get to allow blanks in the C-string Prints the C-string (what they input) Prints the length (number of characters) in the C-stringarrow_forward
- In C++arrow_forwarddont post copied answers posting multiple times sure dislikearrow_forwardPython: On-line Grocery Shopping Use grocery py in Canvas to start your program. It contains two dictionaries: stock and price EX: stock key/value pairs EX: price key/value pairs tomato soup 20 tomato soup 185 cheese 10 cheese 3.99 Create a two functions: first called grocery cost(food), where food can be one item or a list of items from the stock and price dictionaries, the second is called stock check(stock list) where a store manager can check if stock numbers are at a minimum value. The first function loops through the argument food, notes the price, checks the stock, calculates and prints the total cost and changes the stock number. You will need to use a for statement to loop through the items in food and an if statement to check and update the stock. The second function loops through each item in the stock dictionary and uses an if- statement to determine if stock is less than 5.arrow_forward
- def swap_text(text): Backstory: Luffy wants to organize a surprise party for his friend Zoro and he wants to send a message to his friends, but he wants to encrypt the message so that Zoro cannot easily read it. The message is encrypted by exchanging pairs of characters. Description: This function gets a text (string) and creates a new text by swapping each pair of characters, and returns a string with the modified text. For example, suppose the text has 6 characters, then it swaps the first with the second, the third with the fourth and the fifth with the sixth character. Parameters: text is a string (its length could be 0)Return value: A string that is generated by swapping pairs of characters. Note that if the Examples: swap_text ("hello") swap_text ("Party for Zoro!") swap_text ("") def which_day(numbers): → 'ehllo'→ 'aPtr yof roZor!' → '' length of the text is odd, the last character remains in the same position.arrow_forwardDistinctive code RWQUI for code itself..arrow_forwardUsing c++ Contact list: Binary Search A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning