I am trying to get the program to display the dealers hand, and then the players hand. This works. But when I call the hit() function, the dealers hand turns into "X (alpha)" and I don't know why. I am assuming that I am using the friend function wrong?
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include "Player.h"
#include "Dealer.h"
usingnamespace std;
int main()
{
cout << "Press H to hit or S to stay." << endl << endl;
Player pstart;
Dealer dstart;
dstart.deal(); //displays the dealers hand just fine
pstart.deal(); //displays the players hand just fine
char hitstay;
cin >> hitstay;
if (hitstay == 'h')
pstart.hit(); //this is where my problem occurs. When it displays the dealers hand, it gives "X (alpha)", rather than "X (the num I want)".
return 0;
}
Dealer.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef DEALER_H
#define DEALER_H
class Dealer: public Player
{
public:
Dealer();
friendclass Player;
void deal();
void disphanddealer();
protected:
private:
int card1, card2;
char card1f, card2f;
};
#endif // DEALER_H