Playing Card. If/Then Problem

If anyone could please help. I have to create a (if/then and a loop) program where the user inputs three numbers from 1-13 and it's supposed to identify what playing cards the user has (4 required examples below). No playing card suits are required.

EXAMPLES:

All cards are equal.
Sample output for 4 4 4: You have three fours.

Three cards form a straight.
Sample output for 8 6 7: You have a straight ending in eight.

Two cards are equal.
Sample output for 6 6 3: You have a pair of sixes.

Name of the highest card.
Sample output for 11 1 8: You have a jack

This is all I have to start with for now. Having some trouble going on from here. Any suggestions? Thanks!:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<iostream>
#include<string>
using namespace std;

const int PLAYING_CARD_MIN = 1;
const int PLAYING_CARD_MAX = 13;

int main(void)
{
	// 1.1 

	int card1, card2, card3;
	cout << "Please input three playing card numbers ranging from " << 
               PLAYING_CARD_MIN << " to " << PLAYING_CARD_MAX << ", separated by 
               spaces." << endl;
	cin >> card1 >> card2 >> card3;
	cin.ignore(999, '\n');

	// 1.2 Sort Cards

	int smallest, median, largest;

	smallest = card1;
	median = card2;
	largest = card3;

	if (smallest > median)
	{
		int temporary = smallest;
		smallest = median;
		median = temporary;
	}

	if (median > largest)
	{
		int temporary = median;
		median = largest;
		largest = temporary;
	}
	if (smallest > median)
	{
		int temporary = smallest;
		smallest = median;
		median = temporary;
	}
}
Are you really not supposed to use any array, pointer or std::vector?
Here're some hints based on three integer variables:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// I have to create a (if/then and a loop) program where the user inputs 
// three numbers from 1-13 and it's supposed to identify what playing cards 
// the user has (4 required examples below). No playing card suits are required.
// EXAMPLES:
// All cards are equal.
// Sample output for 4 4 4: You have three fours.
// Three cards form a straight.
// Sample output for 8 6 7: You have a straight ending in eight.
// Two cards are equal.
// Sample output for 6 6 3: You have a pair of sixes.?
// Name of the highest card.
// Sample output for 11 1 8: You have a jack

#include <iostream>
#include <string>

constexpr int PLAYING_CARD_MIN = 1;
constexpr int PLAYING_CARD_MAX = 13;

// one, two are supposed to be sorted in descending order
std::string getCombination(int three, int two, int one);

int main()
{
    // 1.1 
    std::cout << "Please input three playing card numbers ranging from "
              << PLAYING_CARD_MIN << " to " << PLAYING_CARD_MAX 
              << ", separated by spaces: ";
    int card1 {}, card2 {}, card3 {};
    std::cin >> card1 >> card2 >> card3;
    std::cin.ignore(999, '\n');

    // 1.2 Sort Cards
    bool again = true;
    while(again) {
        again = false;
        if(card1 > card2) {
            int temp = card1;
            card1 = card2;
            card2 = temp;
            again = true;
        }
        if(card2 > card3) {
            int temp = card2;
            card2 = card3;
            card3 = temp;
            again = true;
        }
    }
    std::cout << card3 << ' ' << card2 << ' ' << card1 << ' '
              << getCombination(card3, card2, card1) << '\n';
    return 0;
}

std::string getCombination(int three, int two, int one)
{
    std::string comb = "you have ";
    // check for tris:
    if(three == two && two == one) {
        comb += "three " + std::to_string(one);
        return comb;
    }
    // check for a straight
    if( /* ... */ ) {
        // ...
        return comb;
    }
    // check for a couple
    if( /* ... */ ) {
        // ...
        return comb;
    }
    // check if the highest card is higher then 10
    if( /* ... */ ) {
        // ...
        return comb;
    }
    // ...
    return comb + "nothing useful";
}

Topic archived. No new replies allowed.