IN C++ CODING 1. Read the contents of a data file (mytext.dat); 2. Process the f
ID: 3602099 • Letter: I
Question
IN C++ CODING
1. Read the contents of a data file (mytext.dat); 2. Process the frequency of characters (a-z) that appear in the data file 3. Print the frequency of characters in the file to the screen; 4. Be able to use an ifstream object; called "charword freq.cpp In this assignment you will implement a program to determine the number of words and the number of occurrences of each letter in a block of text stored in a data file called "mytext.daf". Define a word to be any string of letters that is delimited at each end by either whitespace, a period, a comma, or the beginning or end of a line. You can assume that the input consists entirely of letters, whitespace, commas and periods. When outputting the number of words and letters that occur in a line, be sure to count upper- and lowercase versions of a letter as the same letter. Output the letters in alphabetical order and list only those letters that do occur in the input data file Consider the following example Block of text in the data file hello world ALL is great. HELLO WORLD ALL IS GREAT. hello worlD alL iS great. Output of your program to the screen: 15 words 3 d 3 h 15 1 Your program should be modular, meaning that you should break it up into smaller function(s). Your main program should be as small as possible and well documented.Explanation / Answer
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char inputString[1000];
// we are using an integer array(initialized with zero) to store
// frequency of characters at index equal to their ascii value
int i, count[26] = {0};
cout << "Enter a String ";
gets(inputString);
find_frequency(inputString,count);
}