# How to check if number1, number2, and number3 is equal to a, b and c but not necessarily in this order

If the order doesn't matter, then change the order to something that makes it easy to do. To do that, you can put the guesses and numbers in separate arrays, sort them and then compare. You can make this whole process even easier by using a `std::multiset`

/`std::unordered_multiset`

to do all of this work for you. That would look like

```
bool Guess(int number1, int number2, int number3)
{
int guess1, guess2, guess3;
std::cout << "Enter three numbers separated by spaces: ";
std::cin >> guess1 >> guess2 >> guess3;
return std::multiset<int>{guess1, guess2, guess3} == std::multiset<int>{number1, number2, number3};
}
```

I can suggest the following solution as it is shown in the demonstrative program.

```
#include <iostream>
#include <iomanip>
#include <array>
#include <iterator>
#include <algorithm>
bool Guess( int number1, int number2, int number3 )
{
const size_t N = 3;
std::array<int, N> target = { number1, number2, number3 };
std::sort( std::begin( target ), std::end( target ) );
std::array<int, N> guess;
std::cout << "Enter three numbers separated by spaces: ";
std::copy_n( std::istream_iterator<int>( std::cin ), N, std::begin( guess ) );
std::sort( std::begin( guess ), std::end( guess ) );
return target == guess;
}
int main()
{
int n1 = 3, n2 = 1, n3 = 2;
std::cout << std::boolalpha << Guess( n1, n2, n3 ) << '\n';
return 0;
}
```

Its output might look like

```
Enter three numbers separated by spaces: 1 2 3
true
```

Instead of the call pf the algorithm `std::copy_n`

you can just use the following statement

```
std::cin >> guess[0] >> guess[1] >> guess[2];
```