this the actual assigment:
Write a program that will read in a line of text and output the number of words in the line and the number of occurences of each letter. Define a word that will be any string of letters that is delimited at each end by either a whitespace, a period, a comma, or the beginning or end of the line. You can assume that the input consists entirely of letters, whitespace, commas, and periods. When outputting the number of letters that occur in a line, be sure to count uppercase and lowercase versions of a letter as the same letter. Output the letters in alphabetical order and list only those letters that occur in the inoput line. For example, the input line:
>
> I say Hi.
>
> should produce output similar to the following:
>
> 3 words
> 1 a
> 1 h
> 2 i
> 1 s
> 1 y
========================================
this is what I go to far:
#include <iostream.h>
#include <string.h>
#include <ctype.h>
#include <iomanip.h>
const int sizeArray = 100;
int word(int, int, int);
int letter();
void main()
{
cout << "NAME: "<< endl;
cout << "Course: CPSC241"<<endl;
cout << "Assignment: A4Q1" << endl;
cout << endl;
}
int word(int countword, int morewords, int yetmorewords)
{
int countword = 1;
for (int i = 0; i < sizeArray; i++) //Checks the number of words on the first line.
{
if (i == ' ')
countword++;
else if (i == '.') //These characters indicate the end of a word
countword++d;
else if (i == ',')
countword++;
}
if (i == ' ')
countword++;
else if (i == '.') //These characters indicate the end of a word
countword++d;
else if (i == ',')
countword++;
}
any help would be greatly appreciated. or if anyone has a solution to this program please advise. THANK you very much!!!!