I'm reading about two-dimensional and multi-dimensional arrays at the moment in order to better organize user input. I'm trying to create a function that can store a card player's hand. At the moment I'm just brainstorming how it would look and writing out some notes to myself to organize it in plain english before I break it down into C++.

So far I've figured this:
I'm going to use a two-dimensional array to store cards in a dealt hand. I figured it would have two columns, one to store the card's value and one for its suit. So something like this:

string cardArray[row][col]; //Where row is however many cards are in the hand

I'm not quite sure if string is the right data type to go about this.

In program execution I want the user to enter suit (S for spade, H for heart, D for diamond, and C for club) followed by a space then the face value in int form (1-13 with the Ace as 1, Jack as 11, Queen as 12, and King as 13).

Since the suit is a char/string and the face value is an int I wonder if it would be best to create two seperate one-dimensional arrays for suit and value then use a cin statement to store the values. My only concern is being able to call on the values and compare them against each other to determine little flags (only card in suit or no cards in a specific suit for example).

Any help to consolidate the ideas swarming around in my head would be much appreciated.

You could create an 'Card' class.And then store cards in an array or a vector.Something like this:

class Card  {
   int number;
   std::string type[]={spade,...};
   //Constructors and functions
 };
std::vector <Card> CardsPack;

I'm not extremely familiar with classes, but I do suppose I could look more in depth into them. When creating a class, would you suggest is contained all the cards in a deck (so any user input can be called from it and compared in another function) or would it just hold what is in the user hand?

A class is usually used to represent an object of some sort .. You should think of it "Is a card an object?" , and if the answer is yes then make it a class or a struct.A card object should encapsulate all the features of a card.A hand of cards should be just that , a collection of cards which can also be represented by a class or a structure.So look into classes and try to think of them as objects with sets of features and stuff.

class Card; // declaration
class Hand {
   Card cards[5]; 
   //etc..
 };
This article has been dead for over six months. Start a new discussion instead.