I have three funcitons that all have arrays. I need to make a print function. Here is one of the functions.
void findUpperCase()
{
infile.open("trytext.txt");
int count = 0;
char letters[MAX_LETTERS];
int upperLetters[26] = {0};
while ( infile.peek() !=EOF )
{
infile >> letters[count];
count++;
}
infile.close();
for ( int i = 0 ; i < count ; i++ )
{
if ( letters[i] >= 'A' && letters[i] <= 'Z' )
{
upperLetters[letters[i]-'A']++;
}
}
for ( int i = 0 ; i < 26 ; i++ )
{
cout << (char)(i +'A') << " occurs " << upperLetters[i] << " times entered" << endl;
}
}
I think I need to return the upperLetters array so I can call it in a print function, but I have no idea if you can return an array, or how I would do that.
I want to use this in the print function
for ( int i = 0 ; i < 26 ; i++ )
{
cout << (char)(i +'A') << " occurs " << upperLetters[i] << " times entered" << endl;
}