My assignment:

1- Rewrite your C++ program in Project 1 to compute the number of words, average length and
lengths of the words in the text file words.txt – the input file. Each line in the input file
contains exactly one word. The words in the input file are sorted lexicographically in
dictionary style. Use an array histogram_words of constant length to compute and store the
lengths of the words in the input file. Write the computed statistics into another text file
words_statistics.txt – the output file. The output file will contain a line (or lines) at the beginning
of the file explaining the output. This is followed by the computed word length statistics.
2- Amend your program to compute the total number of letters and the probability of letters [a –
z] in the input file. Use an array histogram_letters of constant length to compute and store the
probability of letters in the input file. Write the computed statistics into the output file
following the word length statistics. Compare the computed letter probabilities to published
data on the Web.
3- The C++ program will be comprised of a main function and a function words_statistics that
computes and outputs the computed statistics. The program will include all necessary checks
and assertions.
4- Submit a printed report including the full, complete, and documented C++ program and a
print-out of the output file. Use formatting instructions to make the layout neat and easy to
read.

What I have coded so far:
1 #include <iostream>
2 #include <string>
3 #include <fstream>
45
using namespace std;
67
void word_statistics(string file_name){
8 string line;
9 std::ifstream infile(file_name);
10 int words_count[14];
11 for(int i = 0; i < 14; i++){
12 words_count[i] = 0;
13 }
14 int no_of_words = 0;
15 int total_length = 0;
16 while (infile >> line)
17 {
18 int l = line.length();
19 if(l > 13){
20 words_count[13] += 1;
21 }
22 else{
23 words_count[l-1] += 1;

words.txt:
aa
aah
aahed
aahing
aahs
aal
aalii
aaliis
aals
aardvark
aardvarks
aardwolf
aardwolves
aas
aasvogel
aasvogels
aba
abaca
abacas
abaci
aback
abacus
abacuses
abaft
abaka
abakas
abalone
abalones
abamp
abampere
abamperes
abamps
abandon
abandoned
abandoning
abandonment
abandonments
abandons
abas
abase
abased
abasedly
abasement
abasements
abaser
abasers
abases
abash
abashed
abashes
abashing
abasing
abatable
abate
abated
abatement
abatements
abater
abaters
abates
abating
abatis
abatises
abator
abators
abattis
abattises
abattoir
abattoirs
abaxial
abaxile
abbacies
abbacy
abbatial
abbe
abbes
abbess
abbesses
abbey
abbeys
abbot
abbotcies
abbotcy
abbots
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
abdicate
abdicated
abdicates
abdicating
abdication
abdications
abdomen
abdomens
abdomina
abdominal
abdominally
abduce
abduced
abducens
abducent
abducentes
abduces
abducing
abduct
abducted
abducting
abductor
abductores
abductors
abducts
abeam
abed
abele
abeles
abelmosk
abelmosks
aberrant
aberrants
aberration
aberrations
abet
abetment
abetments
abets
abettal
abettals
abetted
abetter
abetters
abetting
abettor
abettors
abeyance
abeyances
abeyancies
abeyancy
abeyant
abfarad
abfarads
abhenries
abhenry
abhenrys
abhor
abhorred
abhorrence
abhorrences
abhorrent
abhorrer
abhorrers
abhorring
abhors
abidance
abidances
abide
abided
abider
abiders
abides
abiding
abied
abies
abigail
abigails
abilities
ability
abioses
abiosis
abiotic
abject
abjectly
abjectness
abjectnesses
abjuration
abjurations
abjure
abjured
abjurer
abjurers
abjures
abjuring
ablate
ablated
ablates
ablating
ablation
ablations
ablative
ablatives
ablaut
ablauts
ablaze
able
ablegate
ablegates
abler
ables
ablest
ablings
ablins
abloom
abluent
abluents
ablush
abluted
ablution
ablutions
ably
abmho
abmhos
abnegate
abnegated
abnegates
abnegating
abnegation
abnegations
abnormal
abnormalities
abnormality
abnormally
abnormals
abo
aboard
abode
aboded
abodes
aboding
abohm
abohms
aboideau
aboideaus
aboideaux
aboil
aboiteau
aboiteaus
aboiteaux
abolish
abolished
abolishes
abolishing
abolition
abolitions
abolla
abollae
aboma
abomas
abomasa
abomasal
abomasi

This is the correct code

#include "iostream"//include statement(s)
#include "iomanip"
#include "fstream"
using namespace std;//using namespace statement(s)
int main()
{
char filename[17];
cin >> filename;
ifstream in_stream;
ofstream out_stream;
in_stream.open(filename);
out_stream.open("results.txt");
char myChar;
bool isWhiteSpace (char myChar);
{
switch (myChar)
{
case '\n':
case '\t':
case ' ' :
case '\r':
case ',':
case '.':
case '?':
case '!':
return true;
break;