Hi Entropicvamp,
The array dealcards is defined there as returning an integer. Notice the first part of the function that reads "int". So in order to return a value from the function, you have to use.... the return statement.
What you will need to do is have this function come up with the cards from the deck and perhaps add them together to formulate an integer score. For instance if you pull an ace and a 10, you would return 21.
cpp
int dealCards(int numberOfCards, string message){
int sumOfCards = 0;
//Do some stuff in here to get the card values
//Set the variable sumOfCards to the value calculated by random cards
return sumOfCards;
}
Notice from the example above that we use the return statement to tell the function to return the value stored in the sumOfCards variable. Also notice that the type of value we return also matches the type returned by the function (sumOfCards is an int variable and the function shows that it must return an int).
If your function has a return type (that is the int on the front of the function) of anything but void, you are going to need to use the return statement.
If the function won't do anything but print or manipulate data and is not designed to return a value to the calling function, then you would use the return type "void".
Read up on return types for functions and the return statement for more information. This will solve your error.
This post has been edited by Martyr2: 31 Mar, 2008 - 09:09 PM