I am having trouble passing a data value to a function. Here is my code:
void get_hand()
{
char card[3]("A");
int number(0),
score(0);
instructions();
cout << "How many cards are you holding? ";
cin >> number;
value_check(number);
do
{
cout << "Enter value of card " << number << ": ";
cin >> card;
calculate_score(score, card); //here's the problem
number--;
}while(number > 0);
return;
}
void calculate_score(int& score, char card)
{
cout << endl << score << endl;
return;
}
I get the following errors when I try to compile:
Error E2034 HW3.cpp 119: Cannot convert 'char *' to 'char' in function get_hand()
Error E2342 HW3.cpp 119: Type mismatch in parameter 'card' (wanted 'char', got 'char *') in function
get_hand()
Any help? Thanks!
void get_hand()
{
char card[3]("A");
int number(0),
score(0);
instructions();
cout << "How many cards are you holding? ";
cin >> number;
value_check(number);
do
{
cout << "Enter value of card " << number << ": ";
cin >> card;
calculate_score(score, card); //here's the problem
number--;
}while(number > 0);
return;
}
void calculate_score(int& score, char card)
{
cout << endl << score << endl;
return;
}
I get the following errors when I try to compile:
Error E2034 HW3.cpp 119: Cannot convert 'char *' to 'char' in function get_hand()
Error E2342 HW3.cpp 119: Type mismatch in parameter 'card' (wanted 'char', got 'char *') in function
get_hand()
Any help? Thanks!