count words, uppercase, characters

hey this is my first time taking c++ I am having a hard time with this problem:

•MAX_COUNT is a constant and equal to 30
•The Calculate Stats box should determine

◦the number of words entered
◦the number of capital letters entered
◦the number of letters entered between 'a' and 'm'
•A valid entry is any lowercase or uppercase letter. Punctuation and numbers should not be allowed. Spaces are allowed.
•The valid letters must be stored in a one-dimentional array

so far I have two separate codes
first one for word count

#include <iostream>
#include <string>
using namespace std;
int main()
{
const int Max_Count = 30;
string inputstring;
cout << "please type in a string: ";

int count(0);

while(cin.get() != '\n'){
cin >> inputstring;
count++;
}

cout << "The string \""<<inputstring<<"\" has "<< count <<" words"<<endl;


cin.get();
cin.ignore();
return 0;
}


second one for letters 'a' and 'm'

#include <iostream>
#include <string>
using namespace std;
int main()
{
string input;
cout << "please type in a string: ";
getline(cin.input);

int numOfChars= 0

for (unsigned int i=0;i < input.length(); i++) {
if (input.at(i) == 'a')
if (input.at(i) == 'm')
{
num OfChars++;
}
}
cout << "Number of Characters: " << numOfChars << endl;
return 0;
}

I know the second one is wrong. I dont know how to put all together. please help thanks :)
Topic archived. No new replies allowed.