Hello,
I'm back again and i brought my code.. This Program counts upper/ lower case letters, digits, end of sentence markers, intrasentence markers, Blanks, and all other symbols, and then approximate the following statistics on average word and sentence length. But i'm not to sure if this is the right way to do it. I would really appreciate anyones concerns. Thanks again.

#include <iostream>
#include <cctype>
#include <fstream>
using namespace std;


void incrementCounter (  int&, int&, int&, int&, int&, int&, int&, int&, int&, int&);
void printCounters (int, int, int, int, int, int, int,int, int );


int main()
{


ifstream cin;



int letterCount = 0;
int periodCount = 0;
int questCount = 0;
int exclamCount = 0;
int UpperCaseCount = 0;
int lowerCaseCount = 0;
int commaCount = 0;
int semiColonCount = 0;
int colonCount = 0;
int blanksCount = 0;


cin.open ("textfile.txt");



cin >>  letterCount, periodCount, questCount, exclamCount, UpperCaseCount, lowerCaseCount, commaCount, semiColonCount, colonCount, blanksCount;


}



void incrementCounter (  int& letterCount, int& periodCount, int& questCount, int& exclamCount, int& UpperCaseCount, int& lowerCaseCount, int& commaCount, int& semiColonCount, int& colonCount, int& blanksCount)
{


switch()
{
case '.': periodCount++;
break;
case '?': questCount++;
break;
case '!': exclamCount++;
break;
case 'A-Z': UpperCaseCount++;
break;
case 'a-z' : lowerCaseCount++;
break;
case ',': commaCount++;
break;
case ';': semiColonCount++;
break;
case ':': colonCount++;
break;
case ' ':blanksCount++;
break;
default :;
}
}



void printCounters ( int letterCount, int periodCount, int questCount, int exclamCount, int UpperCaseCount, int lowerCaseCount, int commaCount, int semiColonCount, int colonCount, int blanksCount)
{
cout << endl;
cout << "Input contained"<< endl
<< letterCount << "..Letters" << endl
<< periodCount << "..Periods" << endl
<< questCount << ".. Question Marks" << endl
<< exclamCount << "..Exclamation Marks" << endl;


}

AND here is what i posted last time .. if it helps..
Okay well i have tried to do this program but i'm just not sure if i'm going in the right direction. Well i have to create a text file (Did that) which is inputed into the program, and the program has to count the instances of the following categories of symbols. such as Uppercase and lower case letters, digits, End of sentence markers like periods, question marks, and explanation points, also commas, semicolons, and colons, and Blanks. Okay well i have written some code and i used a switch statement in my processing. but the thing is, i'm not sure if i'm doing it right. And after all these satistics, i have to use them to approximate the average word and sentence length.I need another's help on this if you would, i'd be greatful for your help or for anything.

well, i was unable to find much sense in your code. do u want to create a file or the file is already present. i am unable to understand whether u want to calculate the no. of uppercase,lowercase,........etc, from a string or something else b`coz u r inputing the variables from the file as if the calculations have already been done.
next, u have not used the switch statement properly. there`s should be a variable inside the brackets of switch , which will decide the case.
switch(s)
{
case '.': .....

etc,..
}


please consult a text book on filing and switch statement. they are not tough to understand.
good luck!

In the future, please choose a more descriptive title for your posts. It will do nothing but help attract people to your thread to provide help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.