You tell us how you plan on solving the problem. Yes, there are lots of different hints here, but if you understand them, then it is not too confusing.
You have a start. You are outputting the characters in the string that are alphabetic characters.
These are the steps I would follow:
- Create an empty void count(const char myStr[]) function that does nothing. Compile and make sure the code compiles.
- Call that function from main the way the assignment demonstrates. Make sure that compiles.
- Take your code that you have now that checks isalpha and add it to the count function. Make sure that compiles. Then run it and make sure you get something you expect.
- Now comes the harder part. How do you define the count array. First, don't call it count, because the name of the function has to be count (according to the assignment). So give it a different name. In your current code you made it an array of int. That is good, because the counts will be ints. You specified 256 as the size. That can work but is not the only way. Do you know why you picked 256?
- The answer to the previous question will tell you what to do here. Instead of using cout to output the character at myStr[i] you need to increment the proper count. How you do it depends on how you intend to solve the problem. Work on understanding your solution in English (not code), and if you get stuck then ask about that part here.