I'm trying to convert the numerical value of months to the name using a void function but I cant get it to compile it give me a strange error that is too long to put in the post. I appreciate any help as I've been working on this for a few days. here is a snippet of the area that's giving me a headache.
Can you tell us the line to which the error points? I have found that looking at and just before the problematic line (the one to which the error points) can yield useful results hen debugging. Give this a shot, if you haven't already.
Sometimes the error is actually far before the flagged line, but the compiler can't detect it. They're not perfect after all.
I added comments to the code to show where the problem is happening also this is the error I'm getting : 105 ")) << monthName(currentMonthNumber)' note candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>] ......
I believe one problem is that the function you are using in cout, "monthName(...)", does not return a value (void). You cannot use a function that returns void in a print statement, nor any other statement in which a value is required. Try letting monthName return some value.
Since your current function prints out a value itself, perhaps you can use the call to it as a seperate statement. Assuming the rest of your program is error free, I think this would get the results you're looking for. Alternatively, build a string instead of coutting it in your monthName function, and return it to the caller. This way, you should be able to use it in cout.