this is my function...

int showScores(int player, int computer, int tie) {
  return (  cout << "User: " << player << endl
            << "Computer: " << computer << endl
            << "Ties: " << tie << endl;);

I get these error messages

hw3b.cc: In function 'int showScores(int, int, int)':
hw3b.cc: error: expected `)' before ';' token
hw3b.cc: error: invalid conversion from 'void*' to 'int'
hw3b.cc: error: expected primary-expression before ')' token
hw3b.cc: error: expected `;' before ')' token

Could anyone please tell me why I am getting these errors? I have been trying to figure this out for awhile to no avail.

10 Years
Discussion Span
Last Post by iamthwee

First of all... what is the value you are telling the function to return? The third message means you cannot put a void function to be returned as an int function, so that's why you cannot tell the program to return "cout "


maybe you should make this function a void function and not an int function, this way you print the scroes in the function, without returning anything.


So how would I change that? Do I have to pass-by-reference the variableS?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.