Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
// C++ program to print words in a sentence
#include <iostream>
using namespace std;
void CountAll(string str,int& numw,int a[])
{
string word = "";
for (int i=0;i<str.length();i++)
{
char x=str[i];
if (x == ' '||x==','||x=='.')
{
numw++;
word = "";
}
else
{
if(x>='a'&&x<='z')
a[x-'a']++;
if(x>='A'&&x<='Z')
a[x-'A']++;
word = word + x;
}
}
if(word.length()>0)
numw++;
}
// Driver function
int main()
{
cout<<"Enter a text line: ";
string str;
getline(cin,str);
int numw=0;
int a[26]={0};
CountAll(str,numw,a);
cout<<"Number of words are: "<<numw<<endl;
cout<<"Count of all letters are: ";
cout<<endl;
for(int i=0;i<26;i++)
cout<<(char)('a'+i)<<" "<<a[i]<<endl;
return 0;
}

Kindly revert for any queries
Thanks.
Question 2 Write a program that will read in a line of text up to 100...
I need help building a program on microsoft visual studio using c++ language. implement a program called "charword_freq.cpp" 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.dat”. 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...
write a program in C
Write a program to implement the following requirement: The program will read from standard input any text up to 10, 900, characters and store each unique word (any string that does not contain any whitespace) into a node of a linked list, following the following Node struct: struct NODE { char *word; struct NODE * prev; Note that each node must store a unique word, i.e., no word is stored in more than one node....
(Count the occurrences of words in a text file) Rewrite Listing 21.9 to read the text from a text file. The text file is passed as a command-line argument. Words are delimited by white space characters, punctuation marks (, ; . : ?), quotation marks (' "), and parentheses. Count the words in a case-sensitive fashion (e.g., consider Good and good to be the same word). The words must start with a letter. Display the output of words in alphabetical...
Write a C program to run on ocelot to read a text file and print it to the display. It should optionally find the count of the number of words in the file, and/or find the number of occurrences of a substring, and/or take all the words in the string and sort them lexicographically (ASCII order). You must use getopt to parse the command line. There is no user input while this program is running. Usage: mywords [-cs] [-f substring]...
Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...
Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH уен Hint: Use the fgets function to read a string with spaces from the user...
Write a program that calculates the frequency of letter occurrences in text. Read ASCII text from standard input. On reaching EOF, print to stdout the normalized frequency of occurrence for each letter a-z that appeared in the input, one per line, in alphabetical order using the format produced by printf( "%c %.4f\n", letter, freq); Letters that occur zero times should not appear in the output. Characters other than lower and upper case letters should be ignored. Lower and upper case...
Write a program in C++ to read a large piece of text from the user (multiple lines) until the user inputs EOF. Assume the input only contains alphabets, numbers, commas and periods. The program should first compute the number of occurrences of each character in the input. Next, the program displays a sorted list (in descending order) of each character and the corresponding number of occurrences of that character. The sorting should be performed on the counts and not the...
Write a Python program stored in a file q6.py that takes a text (without punctuation) as input and prints the number of occurrences of each word. Your program is case-insensitive, meaning that uppercase and lowercase of the same letter is considered the same. Printing should be done in decreasing order of the number of occurrences. If several words have the same number of occurrences, they should be printed in alphabetical order. A new line must be printed between the words...
Capitalization JAVA In this program, you will read a file line-by-line. For each line of data (a string), you will process the words (or tokens) of that line one at a time. Your program will capitalize each word and print them to the screen separated by a single space. You will then print a single linefeed (i.e., newline character) after processing each line – thus your program will maintain the same line breaks as the input file. Your program should...