Well, heres a code that I wrote that displays the number of letters in lower case of any sentence that I put into the program.
#include <iostream>
#include <string>
using namespace std;
int main()
{
int count[256] = { };
string str;
getline(cin,str);
for(string::iterator it = str.begin(); it != str.end(); ++it)
count[*it]++;
for(char ch='a'; ch <= 'z'; ++ch)
cout << ch << " - " << count[ch] << endl;
}
Could anyone help by telling me how I can add to it so it also counts upper case letters and also numbers 0-9? I am having so much trouble, and I left my Savitch book at my friends home :[
Thanks