void plot_letter_frequencies(letter_frequencies& input)
{
ltr_freq_pair print_array[52];
ltr_freq_pair temp;
int i,j;
//fills the array
for (i=0; i<52; i++)
{
print_array[i]=input.get_item(i);
}
//sorts the array from largest count to smallest count
for(int top=52; top>0; --top)
for(int k=0; k<top; ++k)
if(print_array[k] < print_array[k+1])
{
temp=print_array[k];
print_array[k]=print_array[k+1];
print_array[k+1]=temp;
}
/*this is the part that doesn't work. I want to go through the array and print an asterisk for every unit in count. But when I went to test my loops, it claims it doesn't know what > means for an int....*/
for(j=print_array[1].count; j>0; j--)
{
for (i=0; i<13; i++)
{
if (print_array[i]>j) //line 49
cout<<" * ";
else
cout<<" ";
}
cout<<"\n";
}
//end part-that-doesn't-work
}
ln 49: error C2679: binary '>' : no operator which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
I am utterly bewildered by this error. If I'd failed to define the operator for a class, it would make sense, but how can I persuade it that it knows how to compare ints? Am I missing something obvious?