Can anyone help me with my Blackjack C++ project?
I started hobbyist programming in BASIC as a preteen and then C three-four years ago, in addition to several other languages along the way (Python, Scheme, PHP, VB). My programming experience until this college semester, even if the language I was programming in was technically object-oriented, has been in strictly in functional programming. But now I am in college and taking a C++ class, my first foray into the object oriented programming realm, and am having some difficulty with my current project, a card game (Blackjack), in which I will be passing around a bunch of strings to indicate the face of a card (there is a card class) and the status of the dealer class. My main problem? The function that I have defined to get the status of the dealer class, which is defined so that it returns a string variable is giving me the following compiler error:
Here is the class definition file:
class Dealer
{
public:
void play();
void hit();
void stay();
void quit();
string get_status();
private:
string status;
CardDeck card_deck;
};
Here is the class implementation file:
|----------------------------------------|
| MODULE NAME: Dealer.cpp |
| |
| ABSTRACT: class implementation |
| MACHINE/OS: |
| PROGRAM TYPE: |
| REVISIONS: |
| DESCRIPTION: Dealer class |
|----------------------------------------|
*/
#include "Dealer.h"
void Dealer::play()
{
return;
}
void Dealer::hit()
{
return;
}
void Dealer::stay()
{
return;
}
void Dealer::quit()
{
return;
}
void Dealer::get_status()
{
return;
}
Can anyone tell from the class files what I've left out or where I've made my mistake?
Thanks in advance.
the return type in the header is 'string'.. which requires you to do an include for either the STL or regular version of string
so either you need #include <string.h>
or
#include <string>
(after all includes...) using namespace::std;
Also: it may have to be either 'string your_data' or 'String your_data' (im coding in python right now, so I forgot, just try the 4 combos with the two headers)
-----
p.s. indent your code like in the definitions after a public/private block such as
public:
void this_is_a_fuc()
private:
char dude[50];
-----
post here if it does or doesn't work