Language: C++

#include <iostream>
using namespace std;

struct Card { char suit, value; };

int main(void)  {
	Card C1[100], C2[100];
	int n;
	char ch;
	
	cin >> n;
	for (int i = 0; i < n; i++)  {
		cin >> C1[i].suit >> C1[i].value;
		}
		
		for (int i = 0; i < n; i++)
			C2[i] = C1[i];
			
		bubble(C1, n);
		selection(C2, n);
		
		printf(C1, n);
		cout << "Stable" << end1;
		printf(C2, n);
		if (isStable(C1, C2, n))  {
			cout << "Stable" << end1;
		} else {
			out << "Not stable" << end1;
	}		
	return 0;
}

void bubble(struct Card A[], int n)	{
	for (int i = 0; i < n; i++)	{
		for (int  j = 0; j < n - 1; j > i + 1; j--)	{
			if (A[j].value < A[j-1].value)	{
				Card t = A[j];
				A[j] = A[j-1];
				A[j-1] = t;
			}
		}
	}			
}	

void selection(struct Card A[], int n)		{
	for (int i = 0; i < n; i++)	{
		int minj = i;
		for (int j = i; j < n; j++)	{
			if (A[j].value < A[minj].value)
				minj = j;
		}
		Card t = A[i];
		A[i] = A[minj];
		A[minj] = t;
	}
}

void print(struct Card A[], int n)	{
	for (int i = 0; i < n; i++)	{
		if (i > 0)
			cout << " ";
		cout <<  A[i].suit << A[i].value;
	}
	cout << end1;
}

bool isStable(struct Card C1[], struct Card C2[], int n)  {
  for (int i = 0; i < n; i++)  {
    if (C1[i].suit != C2[i].suit)
      return false;
    }
  return true;
}


				

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'bubble' was not declared in this scope
   19 |                 bubble(C1, n);
      |                 ^~~~~~
a.cc:20:17: error: 'selection' was not declared in this scope; did you mean 'select'?
   20 |                 selection(C2, n);
      |                 ^~~~~~~~~
      |                 select
a.cc:22:24: error: cannot convert 'Card*' to 'const char*'
   22 |                 printf(C1, n);
      |                        ^~
      |                        |
      |                        Card*
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:23:37: error: 'end1' was not declared in this scope
   23 |                 cout << "Stable" << end1;
      |                                     ^~~~
a.cc:24:24: error: cannot convert 'Card*' to 'const char*'
   24 |                 printf(C2, n);
      |                        ^~
      |                        |
      |                        Card*
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:25:21: error: 'isStable' was not declared in this scope
   25 |                 if (isStable(C1, C2, n))  {
      |                     ^~~~~~~~
a.cc:28:25: error: 'out' was not declared in this scope
   28 |                         out << "Not stable" << end1;
      |                         ^~~
a.cc: In function 'void bubble(Card*, int)':
a.cc:35:54: error: expected ')' before ';' token
   35 |                 for (int  j = 0; j < n - 1; j > i + 1; j--)     {
      |                     ~                                ^
      |                                                      )
a.cc:35:56: error: 'j' was not declared in this scope
   35 |                 for (int  j = 0; j < n - 1; j > i + 1; j--)     {
      |                                                        ^
a.cc: In function 'void print(Card*, int)':
a.cc:64:17: error: 'end1' was not declared in this scope
   64 |         cout << end1;
      |                 ^~~~