I need to write a program that reads a string from the keyboard and then outputs the number of occurrences of each letter in the alphabet as it pertains to the string. I also need to be able to count the number of words in the string. So far, here is the code I have come up with.
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
const int size=100;
char string[size];
char *sPtr = string;
cout <<"Enter a sentence of "<<size<<" characters or less to be analyzed.\n";
cin.getline(string,'\n');
return 0;
}
If anybody knows of a quick and easy way to accomplish this I would be eternally greatful. Yes this is a homework problem if anyone wonders, but I'm not looking for a handout. Thanks for everybody's help in advance!!!