Write a program, which takes a text file as its input and produces another text file containing the
following information:
total number of characters
total number of words
length of the longest word
length of the shortest word
average word length.
Results should be automatically saved in the text file which name is generated as:
inputFileName_out.txt, where inputFileName is the name of the input text file.
I started somehow pls help me to end PLS!!!
#include "std_lib_facilities.h"
using namespace std;
int main()
{
char characters; int counter = 0, counterW = 0;
string words;
ifstream inpFile;
inpFile.open("text.txt");
if (inpFile.is_open()) {
while (inpFile >> characters) counter++;
cout << counter << " characters\n";
The other stats you get from taking input one word at a time.
* Count of words
* Minimum of word.length()
* Maximum of word.length()
* Sum of word.length()