CAUsers BoylelDesktop Fall 2016 projects Pet e Project Three Message Analyzer Enter file name p3in5. txt Message Report Boyle Name Input File Name p3in5.txt Output File Name: outPut p3in5. txt Number of lines Number of chars 149 Five Most Used Characters \'E\' 18 counted 18 counted 18 counted T. 12 counted \'A\' 11 counted Characters Not Used Character occurence A count C count 11 B count 4 E count 18 F count D count G Count H Count I count J count 1 K count L count N count 9 O count 18 M Count P count Q count PR count 18 S count T count 12 U count V count count W 3 X count Z count Y count Original Message Contents 9 8 7 6 5 You must have a line return after the last character in your message in order for our example code to run proper ly you must work alone on this project don\'t be a cheater do your own work Character Stats: 203 total chars processed PERCENT TYPE COUNT Digits O. 02596 Upper Case O. 005% Hex Digit 46 O. 22796 Punctuation 6 O. 0306 -Control O. 02596 Lower Case 148 O. 72996 Alpah Numer O. 75996 154 Printable 198 0.975% Space O. 21296 Process returned 0 (0x0) execution time 5.050 s Press any key to continue
//this program will count the frequency of each characters in c
#include<stdio.h>
#include<conio.h>
using namespace std;
//array to count the characters
int count[26];
//execution from here
int main()
{
//file pointer
FILE *f;
int i;
char ch;
int charCount=0,line=0;
// open input file name with access mode
f = fopen(\"input.c\",\"r\");
read each content of file
while(!feof(f))
{
//get each character
ch = fgetc(f);
//Increment the character count
charCount++;
if(ch==\'\ \')
line++;
//increment the corresponding character and update the count
count[ch - \'a\']++;
}
//display element (alphabet) with count
for(i = 0;i < 26;i++)
printf(\"count[%c] = %d\ \",65+i,count[i]);
//display line count and character count
printf(\"\ No of lines =%d\",line);
prinf(\"No of characters=%d\",charCount);
//close file
fclose(f);
return 0;
getch();
}