Question
The program I wrote does not give me all output I need. // TODO (1): #include directives and namespace statement here # include # include
The program I wrote does not give me all output I need.
// TODO (1): #include directives and namespace statement here
# include
# include
using namespace std;
enum Ranks{ACE=1,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN,JACK,QUEEN,KING};
enum Suits{CLUBS=0, HEARTS, SPADES, DIAMONDS};
int main() {
const string LINE = "--------------------";
// TODO (2): declare variables here
string c;
string suitName, rankName;
// TODO (3): prompt user for matchword; read in the value
cout
cin >> c;
// TODO (4): consider declaring and initializing additional variables
// TODO (5): start output with a line
cout
for (int suit = CLUBS; suit
// TODO (6): if suit == CLUBS, then suitName = "Clubs", , else if suit == HEARTS, then suitName = "Hearts", ...
if( suit == CLUBS){ suitName = "Clubs";}
else if (suit == HEARTS){ suitName = "Hearts";}
else if (suit == SPADES){ suitName = "Spades";}
else{suitName = "Diamonds";}
for (int rank =ACE; rank
// TODO (7): if rank == ACE, then rankName = "Ace", ...
if( rank == ACE){ rankName = "Ace";}
else if (rank == TWO){ rankName = "Two";}
else if (rank == THREE){ rankName = "Three";}
else if (rank == FOUR) {rankName = "Four";}
else if (rank == FIVE) {rankName = "Five";}
else if (rank == SIX) {rankName = "Six";}
else if (rank == SEVEN) {rankName = "Seven";}
else if (rank == EIGHT) {rankName = "Eight";}
else if (rank == NINE) {rankName = "Nine";}
else if (rank == TEN) {rankName = "Ten";}
else if (rank == JACK) {rankName = "Jack";}
else if (rank == QUEEN) {rankName = "Queen";}
else {rankName = "King";}
// TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN,JACK,QUEEN,KING};
// TODO (8): output the current card info if the match word equals the suitName OR the match word equals the rankName
if ( c == suitName || c == rankName){ cout
else if ( c == rankName || c == suitName){cout
else if( c == "." ){ cout
}
}
// TODO: (7) output (no matches) if nothing matched
// TODO: (8) nish output with a line
while (( c == suitName && c != rankName )&& ( c == rankName && c != suitName)) {
if(c != "." ){ cout break;}
}
cout
return 0;
} It doesnt print correct output could you check my program and see what I have to correct?
Enter match word ('.' for match all): Swords - - - - - - - - - - - - - (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 - - - - - - - - - - - - - - - - - - - - Enter match word ('.' for match all): Swords - - - - - - - - - - - - - (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 DiamondsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started