Question

I understand how to implement this in one file, but I'd love to see it as...

I understand how to implement this in one file, but I'd love to see it as in the Directions here into 3 files.as an example. Thank you!

Direction: Create class having separate executable file, header file and implementation file. Write class with appropriate constructors to initialize the values of member variables.

Create a card game called flash card using class data structure when each player draws three cards for random numbers (1-4) as Diamond, Spade, Clubs and Hearts respectively and another set of random numbers of card value 1-13. The cardScore is defined as highest (say cardScore =100 for three A s’ (cardValue 1), followed by three Jacks (cardValue 11) (say cardScore 90), followed by three Kings (cardValue 13)(say cardScore =80) and then three Queens (cardValue 12)(say cardScore = 70). Other than the above said combinations the cardScore is defined by the sum of the cardValue of each draw. The player which has the highest score after three draws win. Display the cards drawn by each player and the cardScore and the winner. Write the C++ code and algorithm in words for the following problem

Homework Answers

Answer #1

#include <iostream.h>

#include<conio.h>

using namespace std;

class data structure

{

private: string suit; int value;

public:

data structure(int v,string s)

{

value =v;

suit = s;

}

int getvalue()

{

return value;

}

string getsuit()

{

return suit;

}

};

int main()
{
 int n,i,k;
 string b;
 Card c [52];

 for(k = 0; k < 52; k++)
 {
      Card card (i, b);
      c[j] = card;
      for(n = 0; n < 4; n++
 {
 switch (n)
 {
case 1: b = "Hearts";
break;
case 2: b = "Spades";
 break;
 case 3: b = "Diamonds";
 break;

 case 4: b = "Clubs";
 break;
};
for(i = 0; i < 13; i++)
{

  }
 }
for(j = 0; j < 52; j++)
    
switch (c[j].getvalue
 {
 case 1: cout << " Ace";
   break;

 case 11: cout << " Jack";
   break;

  case 12: cout << " Queen";
  break;

 case 13: cout << " King";
  break;

  default: c.getvalue;
    }
 cout << " of " << c[j].getsuit;
    } return 0;
}
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT