i need to use function but i think my card value and calculate hand functions are not working right. not sure what to do.

#include <iostream>
using namespace std;

void instructions ( );
void input (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5);
int calculate_hand (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5);
int card_value(char card);
int main ( )
{

char yes;
int number_of_cards;
char card_value1;
char card_value2;
char card_value3;
char card_value4;
char card_value5;
char card;
int value_of_cards;

do{

input (number_of_cards, card_value1, card_value2, card_value3, card_value4, card_value5);
card_value(card);

calculate_hand ( value_of_cards,  card_value1,  card_value2, card_value3,  card_value4,  card_value5);

cout << "Again? (y/n)" << endl;
cin >> yes;
cout << endl;


}while (yes == 'Y' || yes == 'y');

system ("Pause");
return 0;
}

void instructions ( )
{
cout << "This program scores a blackjack hand. The user is asked how many cards" << endl;
cout << "he or she has, and the card values. This program will then output the user's" << endl;
cout << "scores. The output will be either: a number between 2 and 21, or the word BUSTED" << endl << endl;
cout << "The values of the cards should be inputted as the following: input the numbers" << endl;
cout << "2-9 just as inputting regular numbers, for the number 10 input 't', for jack" << endl;
cout << "input 'j' for queen input 'q', for king input 'k', and for ace input 'a'" << endl << endl;
}

void input (int& number_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5)
{
cout << "Please input the number of cards in your hand (either 2, 3, 4, or 5)" << endl;
cin >> number_of_cards;
cout << endl;
if (number_of_cards == 2)
{
cout << "Please input the value of the first card: " << endl;
cin >> card_value1;
cout << "Please input the value of the second card: " << endl;
cin >> card_value2;
cout << endl << endl;
}
else if (number_of_cards == 3)
{
cout << "Please input the value of the first card: " << endl;
cin >> card_value1;
cout << "Please input the value of the second card: " << endl;
cin >> card_value2;
cout << "Please input the value of the third card: " << endl;
cin >> card_value3;
cout << endl << endl;
}
else if (number_of_cards == 4)
{
cout << "Please input the value of the first card: " << endl;
cin >> card_value1;
cout << "Please input the value of the second card: " << endl;
cin >> card_value2;
cout << "Please input the value of the third card: " << endl;
cin >> card_value3;
cout << "Please input the value of the fourth card: " << endl;
cin >> card_value4;
cout << endl << endl;
}
else if (number_of_cards == 5)
{
cout << "Please input the value of the first card: " << endl;
cin >> card_value1;
cout << "Please input the value of the second card: " << endl;
cin >> card_value2;
cout << "Please input the value of the third card: " << endl;
cin >> card_value3;
cout << "Please input the value of the fourth card: " << endl;
cin >> card_value4;
cout << "Please input the value of the fifth card: " << endl;
cin >> card_value5;
cout << endl << endl;
}
}

int calculate_hand (int& value_of_cards, char& card_value1, char& card_value2, char& card_value3, char& card_value4, char& card_value5)
{

	value_of_cards= card_value1+ card_value2+ card_value3+ card_value4+ card_value5;
return (value_of_cards);
}

int card_value( char card)
{
	switch (card)
	{
	case'2':
		card=2;
	break;


	    case'4':
		card=4;
		break;

		case'5':
		card=5;
		break;

		case'6':
		card=6;
		break;

		case'7':
		card=7;
		break;
			
		case'8':
		card=8;
		break;

		case'9':
		card=9;
		break;

	    case'10':
		card=10;
		break;

		case'j':
		card=10;
		break;

		case'J':
		card=10;
		break;


	    case'q':
		card=10;
		break;

        case'Q':
		card=10;
		break;


	    case'k':
		card=10;
		break;


		case'K':
		card=10;
		break;



		case'a':
		card=11;
		break;




        case'A':
		card=11;
		break;





        case'1':
		card=1;
		break;





		default:

		case 't':
			card= -1;
             break;

		case 'T':
				card= -1;
				break;


				return (card);

	}
		


}

I know exactly what the first reply will say, "Use code tags please".

I think ye' blackjack program should follow this kinda scheme:

//Make your cards like this
struct card
{
     char suit;
     int value;
} deck[52];

//Use these functions to check the hand
bool is_royal_flush(card hand[]);
bool is_straight_flush(card hand[]);
bool is_4kind(card hand[]);
bool is_full_house(card hand[]);
bool is_flush(card hand[]);
bool is_straight(card hand[]);
bool is_3kind(card hand[]);
bool is_2pair(card hand[]);
bool is_pair(card hand[]);
card get_high_card(card hand[]);

A hand can test true for multiple winning hands, so test from highest winning hand to lowest, and break on the first return of 'true'.

How do poker hands help in a blackjack game? A royal flush would be busted after the third card and never get the other 2.

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.