I have searched and tried multiple solutions and still cannot get the correct results. What I am trying to do is read from a file and count the characters INCLUDING the blank spaces. I am able to count every other character except for the blanks spaces and could use some advice. Here is input file data:
There are lots of symbols in this file: ..;;??
.,.,.,?::: .
int main ()
{
ifstream inData;
char symbol;
int periodCt = 0;
int commaCt = 0;
int questionCt = 0;
int colonCt = 0;
int semicolonCt = 0;
int spacesCt = 0;
inData.open("Switch.txt");
inData >> symbol;
while (inData)
{
switch (symbol)
{
case '.' : periodCt++;
break;
case '?' : questionCt++;
break;
case ',' : commaCt++;
break;
case ':' : colonCt++;
break;
case ';' : semicolonCt++;
break;
case ' ' : spacesCt++;
break;
int main ()
{
ifstream inData;
char symbol;
int periodCt = 0;
int commaCt = 0;
int questionCt = 0;
int colonCt = 0;
int semicolonCt = 0;
int spacesCt = 0;
inData.open("Switch.txt");
inData.get(symbol);
while (inData)
{
switch (symbol)
{
case '.' : periodCt++;
break;
case '?' : questionCt++;
break;
case ',' : commaCt++;
break;
case ':' : colonCt++;
break;
case ';' : semicolonCt++;
break;
case ' ' : spacesCt++;
break;