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.

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?

Member Avatar for iamthwee

If you don't know why your code is wrong you need to re-read your book/notes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.