Question 4: You have a file "word.txt" which contains some words. Your task is to write a C++ program to find the freque
Posted: Thu May 05, 2022 12:59 pm
please solve this with code I am posting it the third time .pls use header files
iOSstream
fstream
or string
use c++ syntax
Thanks
Question 4: You have a file "word.txt" which contains some words. Your task is to write a C++ program to find the frequency of each word and store the word with its frequency separated by a coma into another file word_frequency.txt. Then read word_frequency.txt file and find the word which has the maximum frequency and store the word with its frequency separated by a coma into another file "max_word.txt". Your program should contain the following functions: 1) read function: to read the data.txt and word_frequency.txt file into arrays when needed. 2) write function: to write the results obtained by frequency function and max function in word_frequency.txt and max_word.txt respectively, when needed. 3) frequency function: to find the frequency of each word. 4) max function: to find the word with maximum frequency. Example: word.txt word_frequency.txt max_word.txt Happy Happy,2 Sad Happy,2 Sad, 1 Good Good,1 Bad Bad,1 Happy
iOSstream
fstream
or string
use c++ syntax
Thanks
Question 4: You have a file "word.txt" which contains some words. Your task is to write a C++ program to find the frequency of each word and store the word with its frequency separated by a coma into another file word_frequency.txt. Then read word_frequency.txt file and find the word which has the maximum frequency and store the word with its frequency separated by a coma into another file "max_word.txt". Your program should contain the following functions: 1) read function: to read the data.txt and word_frequency.txt file into arrays when needed. 2) write function: to write the results obtained by frequency function and max function in word_frequency.txt and max_word.txt respectively, when needed. 3) frequency function: to find the frequency of each word. 4) max function: to find the word with maximum frequency. Example: word.txt word_frequency.txt max_word.txt Happy Happy,2 Sad Happy,2 Sad, 1 Good Good,1 Bad Bad,1 Happy