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;
}