MorseCode Decoder Having trouble using hashing and counting whitespace C++
<p>I have a program I have to write using hashing which I am not familiar with and do not really understand. Right now I am having trouble counting the whitespace between the words I am reading in if it is a letter it is separated by one space and once the code makes a word it is separated by two spaces when it is being read in. My decode function works fine but I don't know how to count the spaces. Here is one thing I have tried but it doesn't work any help would be great.</p>

<pre><code>string tmp;
MORSE TABLE[20];
int j = 0, f = 0, k = 0;
char x;
while(!infile.eof())
{
    infile &gt;&gt; tmp;
    infile.get(x);
     if(x == ' ') //check if x is a space
     {
       infile.get(x); //read next character
       if(x == ' ') //check and see if next char is a space
        {
          TABLE[k].insert(' '); //insert space into char array for printing
        }
      }

   if(j &gt;= f) //if true create new object
     { 
         k++; f+=100; 
     }  

    TABLE[k].decode(tmp);//pass in string to decode
    j++;
}//end while loop
</code></pre>

<p>Any help will be appreciated. I am not a very advanced C++ person just a novice. </p>
