[nfbcs] Help with Another Assignment

Mike Gorse mike at straddlethebox.org
Fri Nov 3 12:37:34 UTC 2017


Hi Lanie,

If I try to compile your code, then I get this error:

a31.cpp:71:30: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘void’)
     cout << "Average Grade: " << averageGrades(grades, NUMGRADES) << "%\n";

The "void" is the key here--the compiler thinks that you are trying to 
pass something with a void type to the stream. From that, I'd guess that 
averageGrades() isn't returning a value. When I look at the function 
prototype, it is, in fact, returning void, rather than returning a value 
that can be printed by the caller.

Hth,
-Mike


More information about the NFBCS mailing list