1 answer

Hello i just need a help in this c++ program please 4.10 Assignment Part 1: Deck...

Question:

Hello i just need a help in this c4.10 Assignment Part 1: Deck of Cards In this lab you will write a program that will list certain cards from a standard deckEnter match word (. for match all): Spades Ace of Spades wo of Spades Three of Spades Four of Spades Five of Spades Six of++ program please

4.10 Assignment Part 1: Deck of Cards In this lab you will write a program that will list certain cards from a standard deck of playing cards. The program should begin by prompting the user for a "match word' and reading in that choice. If the match word is ".", the program should print out the names of all 52 cards from the deck Suits listed in this order. Clubs, Hearts, Spades, Diamonds. Ranks within each suit:Ace, Two, Three,.., Nine, Ten, Jack, Queen, King If the match word is the name of a suit or the name of a rank then the program should output only the names of cards that match For example, if the user entered "Queen", then just the four queens would be listed. If the user entered "Clubs", then just the thirteen club cards would be listed. If the word entered by the user matches neither suit nor rank, the program should report "(no matches)". The list of cards should start and end with a "line" of 20 dashes. Here is the output of some sample runs Enter match word for match all): Jack Jack of clubs Jack of Hearts Jack of Spades Jack of Diamonds Enter match word "..for match all): Three Three of Clubs Three of Hearts Three of Spades Three of Diamonds
Enter match word ('.' for match all): Spades Ace of Spades wo of Spades Three of Spades Four of Spades Five of Spades Six of Spades Seven of Spades Eight of Spades Nine of Spades Ten of Spades Jack of Spades ueen of Spades King of Spades Enter match word ('' for match al1): Sworda (no matches) Enter match word('.' for match all):. Ace of Clubs Two of Clubs Three of Clubs Four of Clubs Five of Clubs Nine of Diamonds Ten of Diamonds Jack of Diamonds Queen of Diamonds King of Diamonds Ii In this last example, all 52 cards will be listed. It's been shortened here for brevity

Answers

CODE:

#include <iostream>
using namespace std;

void fourcards(string w)
{
   int i=1;
   string arr[4]={"Clubs","Hearts","Spades","Diamonds"};
   for (int i = 0; i < 4; i++)
cout<<w<<" of "<<arr[i] << " ";
}
void thirteenCards(string w)
{
   int i=1;
   string arr[13]={"Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"};
   for (int i = 0; i <13; i++)
cout<<arr[i] <<" of "<<w<< " ";
}
void Allcards()
{
   int i,j;
   string arr1[13]={"Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"};
   string arr2[4]={"Clubs","Hearts","Spades","Diamonds"};

   for(i=0;i<4;i++)
   {
       for(j=0;j<13;j++)
       {
           cout<<arr1[j]<<" of "<<arr2[i]<<endl;
       }
       cout<<" ";
   }
  
}
int main()
{
   int i,k,flag=0;
   string card[17]={"Ace","Two","Three","Four","Five","Six","Eight","Seven","Nine","Ten","Jack","Queen","King","Clubs","Hearts","Spades","Diamonds"};
   string w;
cout<<"Enter match word ('.' for match all ) :";
cin>>w;
for(i=0;i<17;i++)
{
      
   if(w==card[i]&i<13)
   {
       cout<<" -------------------- ";
       fourcards(w);
       cout<<"-------------------- ";
       flag=1;
      
       }
       else if(w==card[i]&i>=13)
       {
           cout<<" -------------------- ";
           thirteenCards(w);
           cout<<"-------------------- ";
           flag=1;
       }
       else if(w==".")
       {
           cout<<" -------------------- ";
           Allcards();
           cout<<"-------------------- ";
           flag=1;
           break;
       }
   }
   if(flag==0)
   {
       cout<<" -------------------- ";
       cout<<" (no match)"<<endl;
       cout<<"-------------------- ";
   }
return 0;
}

OUTPUT:

CAUsersREDEEMER Desktoplcards.exe Enter match word (. for match ll :Jack Jack of Clubs Jack of Hearts Jack of Spades Jack

ClUsersREDEEMERNDesktoplcards.exe Enter match word (. for match all ) Three Three of clubs Three of Hearts Three of Diamon

CAUsersREDEEMERNDesktoplcards.exe Enter match word (. for match all :Spades Ace of Spades Two of Spades Three of Spades Fou

CAUsersREDEEMERDesktoplcards.exe Enter match word (. for match all ) :Swords Process exited after 3.774 seconds with retu

Select CUsers REDEEMERDesktoplcards.exe Enter match word (.</p><p>For match all) :. Ace of Clubs Two of Clubs Three of Clubs Fou

CAUsersREDEEMERNDesktoplcards.exe Four of Spades Five of Spades Six of Spades Seven of Spades Eight of Spades Nine of Spades

CAUsersREDEEMER Desktoplcards.exe Enter match word (".' for match ll :Jack Jack of Clubs Jack of Hearts Jack of Spades Jack of Diamonds pro Press any key to continue cess exited after 2.928 seconds with return value e

ClUsersREDEEMERNDesktoplcards.exe Enter match word (".' for match all ) Three Three of clubs Three of Hearts Three of Diamonds Process exited after 7.921 seconds with return value θ Press any key to continue .. .

CAUsersREDEEMERNDesktoplcards.exe Enter match word (".' for match all :Spades Ace of Spades Two of Spades Three of Spades Four of Spades Five of Spades Six of Spades Seven of Spades Eight of Spades Nine of Spades Ten of Spades Jack of Spades Queen of Spades King of Spades Process exited after 11.08 seconds with return value e Press any key to continue .. .

CAUsersREDEEMERDesktoplcards.exe Enter match word (".' for match all ) :Swords Process exited after 3.774 seconds with return value e Press any key to continue .. .

Select CUsers REDEEMERDesktoplcards.exe Enter match word (".' for match all) :.

Ace of Clubs Two of Clubs Three of Clubs Four of Clubs Five of Clubs Six of Clubs Seven of Clubs Eight of Clubs Nine of Clubs Ten of Clubs Jack of Clubs Queen of Clubs King of Clubs Ace of Hearts Two of Hearts Three of Hearts Four of Hearts Five of Hearts Six of Hearts Sevenof Hearts Eight of Hearts Nine of Hearts Ten of Hearts Jack of Hearts Queen of Hearts King of Hearts Ace of Spades Two of Spades Three of Spades Four of Spades Five of Spades

CAUsersREDEEMERNDesktoplcards.exe Four of Spades Five of Spades Six of Spades Seven of Spades Eight of Spades Nine of Spades Ten of Spades Jack of Spades Queen of Spades King of Spades Ace of Diamonds Two of Diamonds Three of Diamonds Four of Diamonds Five of Diamonds Six of Diamonds Seven of Diamonds Eight of Diamonds Nine of Diamonds Ten of Diamonds Jack of Diamonds Queen of Diamonds King of Diamonds Process exited after 7.314 seconds with return value e Press any key to continue .. .

.

Similar Solved Questions

1 answer
What are the vertex, focus and directrix of # y=2x^2 +11x-6 #?
What are the vertex, focus and directrix of # y=2x^2 +11x-6 #?...
1 answer
Green Valley Company prepared the following trial balance at the end of its first year of...
Green Valley Company prepared the following trial balance at the end of its first year of operations ending December 31. To simplify the case, the amounts given are in thousands of dollars. UNADJUSTED Debit Credit 34 31 26 93 27 Account Titles Cash Accounts receivable Prepaid insurance Machinery Acc...
1 answer
Please answer 5, 6, 7, 8, 9, 10. 5.5. Consumer finance. The data below show, for...
Please answer 5, 6, 7, 8, 9, 10. 5.5. Consumer finance. The data below show, for a consumer finance company operating in six cities, the number of competing loan companies operating in the city (X) and the number per thousand of the company's loans made in that city that are currently delinquent...
1 answer
Where p denote the population mean of the original random variable 5.7 Problems . Assume X is a n...
where p denote the population mean of the original random variable 5.7 Problems . Assume X is a normally distributed random variable with mean u and stan- dard deviation σ. A sample of size n-5 from this distribution is given as 1. Assume we are interested in the properties of the mean of the ...
1 answer
A capacitor with an initial potential difference of 122 V is discharged through a resistor when...
A capacitor with an initial potential difference of 122 V is discharged through a resistor when a switch between them is closed at t = 0 s. At t = 10.0 s, the potential difference across the capacitor is 1.68 V. (a) What is the time constant of the circuit? (b) What is the potential difference acros...
1 answer
The question says to calculate net income for 2018 using total equity amounds from the two...
The question says to calculate net income for 2018 using total equity amounds from the two years. The equity for 2017 is $208,780 and the equity for 2018 is $314,671. I got all of the numbers correct except for net income, so please help me find the correct number. HP JUVEEL Submit Ek my work mo...
2 answers
The spherical surface r = 1 m, 2 m and 3 m carry surface charge densities...
The spherical surface r = 1 m, 2 m and 3 m carry surface charge densities of 20, -9 and 17. 2 nC/m2 respectively Calculate the electric flux leaving through the surface r 5 m а. Find electric flux density at P (1, -1, 2) b. Four charges are located at the vertices of a rectangular plane shown ...
1 answer
Trying to write this in java code but I'm running into a lot of errors. package...
Trying to write this in java code but I'm running into a lot of errors. package receipt; public class Receipt {    {          int quantity=2, tax=7,i;    String item="0010", description="Paper";    double amt=1.99, amoun...
1 answer
The beam AC is simply supported at A and C and subjected to the uniformly distributed...
The beam AC is simply supported at A and C and subjected to the uniformly distributed load of q=300 N/m plus the couple of magnitude M=2700 N·mas shown. Draw shearing force and bending moment diagrams of the beam. Show all the work leading to the diagrams. [35 marks] q L D B CO -3m-1-3----3m-...
1 answer
No. DATE ota ject is placeotara certain diyrances an erect e 4tumes tho size oF the...
No. DATE ota ject is placeotara certain diyrances an erect e 4tumes tho size oF the ceb...
1 answer
Please help me do all question , i need it by 5 PM 2. Given the...
please help me do all question , i need it by 5 PM 2. Given the following, what is the amount of Capital? Assets: Premises $20,000; Inventory $8,500; Cash $100. Liabilities: Accounts payable $3,000; Loan from A.Adams $4,000 $21,100 b. $21,600 c. $32,400 3. d. $21,400 A debit balance of $100...
1 answer
<div class=""><p>2. Half-life is the time required for half of an amount of a particular compound to degrade (see table below). The half-life of DDT in the soil is from 2 to 15 years, and the half-lif...
2. Half-life is the time required for half of an amount of a particular compound to degrade (see table below). The half-life of DDT in the soil is from 2 to 15 years, and the half-life of DDT in an aquatic environment is 150 years. 1 half-life 50% degraded 2 half-lives 75% degraded 3 half-liv...
1 answer
Topic 2.8 Respirometers Name 1 The oxygen consumption rate of the fish Oplegnathus insignis was examined...
Topic 2.8 Respirometers Name 1 The oxygen consumption rate of the fish Oplegnathus insignis was examined in a respirometer at three different water temperatures and at four different body masses. Computer used to record oxygen Water supply Oxygen meter Respirometer Water out 400 Key 23°C --- 18&...
1 answer
Of the procedure calls for 135 mg of Consider the reduction of 4-t-butylcyclohexanone. If the procedure...
of the procedure calls for 135 mg of Consider the reduction of 4-t-butylcyclohexanone. If the procedure calls for 135 mg of 4-t-butylcyclohexanone, what mass of sodium borohydride should be added? Number 11 mg...
1 answer
Requity = runlevered + (runlevered - rdebt) * debt/equity requity = 15% rdebt = 5% debt/equity...
requity = runlevered + (runlevered - rdebt) * debt/equity requity = 15% rdebt = 5% debt/equity ratio = 1 How do I slove this for runlevered? I am confused by the algebra....
1 answer
A wave with an amplitude of 2.5 cm, a frequency of 12 Hz and a wavelength...
A wave with an amplitude of 2.5 cm, a frequency of 12 Hz and a wavelength of 45 cm travels down a string with a linear density of 0.00245 kg/m. What is the maximum speed and maximum acceleration of a point on the string as the wave passes?...
1 answer
Calculate the pH of each solution. [H_3O^+] = 6.2 times 10^-6 M Express your answer using...
Calculate the pH of each solution. [H_3O^+] = 6.2 times 10^-6 M Express your answer using two decimal places. pH = 5.21 [H_3O^+] = 6.4 times 10^-4 M Express your answer using two decimal place t....