To get a better response in the forum:
(a) put your code in code tags; (you can edit it immediately, using the "Format" menu, if it doesn't come up at first posting;
(b) actually state what your problem is; did the code compile? did it give wrong answers? or what?
These lines make no sense at all, as your compiler will tell you.
1 2 3 4 5
|
char Most = (totalLetters, Most);
cout << " The letter that appears the most is: " << (totalLetters +'A') << " Appears " << totalLetters[Most] << endl;
char Least = (totalLetters, Least);
cout << " The letter that appears the least is: " << (totalLetters +'A') << " Appears " << totalLetters[Least] << endl;
|
Please go back and fix them.
totalLetters is an array. What are you trying to do with
totalLetters +'A'
?
Most
is the name of a function, so don't make it the name of a variable and, given that function returns an int, don't assign it to a char.
= (totalLetters, Least);
This makes zero sense. You can find out how functions are called by reading the tutorial on this site:
http://www.cplusplus.com/doc/tutorial/functions/
If you add some error-checking flags to your compile command (e.g. -Wall -pedantic -Wextra) you will get some hint at syntactically-possible, but almost-certainly-not-intended, lines of code.
Your method won't work if there is more than one letter with the maximum count, and/or more than one letter with the minimum count. Going by the tiles in "Scrabble", several letters could well have zero count.