Language: C++

#include <stdio.h>
#include <iostream>
#include <utility>
using namespace std;

void bubbleSort(TRUMP a[], int n);
void selectionSort(TRUMP a[], int n);
void dispTrumpList(const TRUMP trump[], int n);
bool isStable(const TRUMP t1[], const TRUMP t2[], int n);

typedef struct {
	char mark;
	int num;
} TRUMP;

int main(void)
{	
	int n;
	cin >> n;
	
	TRUMP trump[36], trump1[36], trump2[36];
	for (int i = 0; i < n; i++) {
		cin >> trump[i].mark >> trump[i].num;
	}
	memcpy(trump1, trump, sizeof(trump) * n);
	memcpy(trump2, trump, sizeof(trump) * n);
	
	bubbleSort(trump1, n);
	dispTrumpList(trump1, n);
	if (isState(trump, trump1, n)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	
	selectionSort(trump2, n);
	dispTrumpList(trump2, n);
	if (isState(trump, trump2, n)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	
	return 0;
}

void bubbleSort(TRUMP a[], int n)
{
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j > i; j--) {
			if (a[j].num < a[j-1].num) {
				swap(a[j], a[j-1]);
			}
		}
	}
}

void selectionSort(TRUMP a[], int n)
{
	int i, j;
	for (i = 0; i < n; i++) {
		int minj = i;
		for (j = i; j < n; j++) {
			if (a[j].num < a[minj].num) {
				minj = j;
			}
		}
		swap(a[i], a[minj]);
	}
}

void dispTrumpList(const TRUMP trump[], int n)
{
	for (int i = 0; i < n; i++) {
		cout << trump[i].mark << trump[i].num;
		if (i < n - 1) cout << " ";
		else cout << endl;
	}
}

bool isStable(const TRUMP t1[], const TRUMP t2[], int n)
{
	char m1[9][4] = '\0';
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			if (m1[t1.num-1][j] == '\0') {
				m1[t1.num-1][j] = t1.mark;
				break;
			}
		}
	}
	
	char m2[9][4] = '\0';
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			if (m2[t2.num-1][j] == '\0') {
				m2[t2.num-1][j] = t2.mark;
				break;
			}
		}
	}
	
	for (int i = 0; i < 9; i++) {
		for (int j = 0; j < 4; j++) {
			if (m1[i][j] != m2[i][j]) return false;
		}
	}
	return true;
}

Compiler output:
a.cc:6:6: error: variable or field 'bubbleSort' declared void
    6 | void bubbleSort(TRUMP a[], int n);
      |      ^~~~~~~~~~
a.cc:6:17: error: 'TRUMP' was not declared in this scope
    6 | void bubbleSort(TRUMP a[], int n);
      |                 ^~~~~
a.cc:6:28: error: expected primary-expression before 'int'
    6 | void bubbleSort(TRUMP a[], int n);
      |                            ^~~
a.cc:7:6: error: variable or field 'selectionSort' declared void
    7 | void selectionSort(TRUMP a[], int n);
      |      ^~~~~~~~~~~~~
a.cc:7:20: error: 'TRUMP' was not declared in this scope
    7 | void selectionSort(TRUMP a[], int n);
      |                    ^~~~~
a.cc:7:31: error: expected primary-expression before 'int'
    7 | void selectionSort(TRUMP a[], int n);
      |                               ^~~
a.cc:8:26: error: 'TRUMP' does not name a type
    8 | void dispTrumpList(const TRUMP trump[], int n);
      |                          ^~~~~
a.cc:9:21: error: 'TRUMP' does not name a type
    9 | bool isStable(const TRUMP t1[], const TRUMP t2[], int n);
      |                     ^~~~~
a.cc:9:39: error: 'TRUMP' does not name a type
    9 | bool isStable(const TRUMP t1[], const TRUMP t2[], int n);
      |                                       ^~~~~
a.cc: In function 'int main()':
a.cc:25:9: error: 'memcpy' was not declared in this scope
   25 |         memcpy(trump1, trump, sizeof(trump) * n);
      |         ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <utility>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:28:9: error: 'bubbleSort' was not declared in this scope
   28 |         bubbleSort(trump1, n);
      |         ^~~~~~~~~~
a.cc:29:23: error: cannot convert 'TRUMP*' to 'const int*'
   29 |         dispTrumpList(trump1, n);
      |                       ^~~~~~
      |                       |
      |                       TRUMP*
a.cc:8:32: note:   initializing argument 1 of 'void dispTrumpList(const int*, int)'
    8 | void dispTrumpList(const TRUMP trump[], int n);
      |                    ~~~~~~~~~~~~^~~~~~~
a.cc:30:13: error: 'isState' was not declared in this scope; did you mean 'isStable'?
   30 |         if (isState(trump, trump1, n)) cout << "Stable" << endl;
      |             ^~~~~~~
      |             isStable
a.cc:33:9: error: 'selectionSort' was not declared in this scope
   33 |         selectionSort(trump2, n);
      |         ^~~~~~~~~~~~~
a.cc:34:23: error: cannot convert 'TRUMP*' to 'const int*'
   34 |         dispTrumpList(trump2, n);
      |                       ^~~~~~
      |                       |
      |                       TRUMP*
a.cc:8:32: note:   initializing argument 1 of 'void dispTrumpList(const int*, int)'
    8 | void dispTrumpList(const TRUMP trump[], int n);
      |                    ~~~~~~~~~~~~^~~~~~~
a.cc:35:13: error: 'isState' was not declared in this scope; did you mean 'isStable'?
   35 |         if (isState(trump, trump2, n)) cout << "Stable" << endl;
      |             ^~~~~~~
      |             isStable
a.cc: In function 'bool isStable(const TRUMP*, const TRUMP*, int)':
a.cc:77:25: error: array must be initialized with a brace-enclosed initializer
   77 |         char m1[9][4] = '\0';
      |                         ^~~~
a.cc:80:35: error: request for member 'num' in 't1', which is of pointer type 'const TRUMP*' (maybe you meant to use '->' ?)
   80 |                         if (m1[t1.num-1][j] == '\0') {
      |                                   ^~~
a.cc:81:39: error: request for member 'num' in 't1', which is of pointer type 'const TRUMP*' (maybe you meant to use '->' ?)
   81 |                                 m1[t1.num-1][j] = t1.mark;
      |                                       ^~~
a.cc:81:54: error: request for member 'mark' in 't1', which is of pointer type 'const TRUMP*' (maybe you meant to use '->' ?)
   81 |                                 m1[t1.num-1][j] = t1.mark;
      |                                                      ^~~~
a.cc:87:25: error: array must be initialized with a brace-enclosed initializer
   87 |         char m2[9][4] = '\0';
      |                         ^~~~
a.cc:90:35: error: request for member 'num' in 't2', which is of pointer type 'const TRUMP*' (maybe you meant to use '->' ?)
   90 |                         if (m2[t2.num-1][j] == '\0') {
      |                                   ^~~
a.cc:91:39: error: request for member 'num' in 't2', which is of pointer type 'const TRUMP*' (maybe you meant to use '->' ?)
   91 |                                 m2[t2.num-1][j] = t2.mark;
      |                                       ^~~
a.cc:91:54: error: request for member 'mark' in 't2', which is of pointer type 'const TRUMP*' (maybe you meant to use '->' ?)
   91 |                                 m2[t2.num-1][j] = t2.mark;
      |                                                      ^~~~