Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int bubble(int n, vector<char> a, vector<int> b){
    for(int i = 0; i < n; i++){
        for(int j = n-1; j > 0; j--){
            if(b[j] < b[j-1]){
                swap(b[j], b[j-1]);
                swap(a[j], a[j-1]);
            }
        }
    }
    return 0;
}
int selection(int n, vector<char> a, vector<int> b){
    int minj;
    for(int i = 0; i < n; i++){
        minj = i;
        for(int j = i+1; j < n; j++){
            if(b[minj] > b[j]){
                minj = j;
            }
        }
        if(minj == i){
            continue;
        }
        else{
            swap(b[i], b[minj]);
            swap(a[i], a[minj]);
        }
        
    }
    

    return 0;
}
bool isstable(int n, char a[n], char b[n]){
    for(int i = 0; i < n; i++){
        if(a[i] != b[i]){
            return false;
        }
    }
    return true;
}
int main(void){
    int n;
    cin >> n;
    int b[n], b1[n];
    char c[n];
    for(int i = 0; i < n; i++){
        cin >> c[i] >> b[i];
    }
    char c1[n];
    for(int i = 0; i < n; i++){
        c1[i] = c[i];
        b1[i] = b[i];

    }
    
    bubble(n, c1, b1);
    selection(n, c, b);
    
    for(int i = 0; i < n; i++){
        if(i == 0){
            cout << c1[i] << b1[i];
        }
        else{
            cout << ' ' << c1[i] << b1[i];
        }
    }
    cout << endl << "Stable" << endl;
    for(int i = 0; i < n; i++){
        if(i == 0){
            cout << c[i] << b[i];
        }
        else{
            cout << ' ' << c[i] << b[i];
        }
    }
    if(isstable(n, c1, c)){
        cout << endl << "Stable" << endl;
    }
    else{
        cout << endl << "Not stable" << endl;
    }
}



Compiler output:
a.cc:5:19: error: 'vector' has not been declared
    5 | int bubble(int n, vector<char> a, vector<int> b){
      |                   ^~~~~~
a.cc:5:25: error: expected ',' or '...' before '<' token
    5 | int bubble(int n, vector<char> a, vector<int> b){
      |                         ^
a.cc: In function 'int bubble(int, int)':
a.cc:8:16: error: 'b' was not declared in this scope
    8 |             if(b[j] < b[j-1]){
      |                ^
a.cc:10:22: error: 'a' was not declared in this scope
   10 |                 swap(a[j], a[j-1]);
      |                      ^
a.cc: At global scope:
a.cc:16:22: error: 'vector' has not been declared
   16 | int selection(int n, vector<char> a, vector<int> b){
      |                      ^~~~~~
a.cc:16:28: error: expected ',' or '...' before '<' token
   16 | int selection(int n, vector<char> a, vector<int> b){
      |                            ^
a.cc: In function 'int selection(int, int)':
a.cc:21:16: error: 'b' was not declared in this scope
   21 |             if(b[minj] > b[j]){
      |                ^
a.cc:29:18: error: 'b' was not declared in this scope
   29 |             swap(b[i], b[minj]);
      |                  ^
a.cc:30:18: error: 'a' was not declared in this scope
   30 |             swap(a[i], a[minj]);
      |                  ^
a.cc: At global scope:
a.cc:38:30: error: use of parameter outside function body before ']' token
   38 | bool isstable(int n, char a[n], char b[n]){
      |                              ^
a.cc:38:31: error: expected ')' before ',' token
   38 | bool isstable(int n, char a[n], char b[n]){
      |              ~                ^
      |                               )
a.cc:38:33: error: expected unqualified-id before 'char'
   38 | bool isstable(int n, char a[n], char b[n]){
      |                                 ^~~~
a.cc: In function 'int main()':
a.cc:61:15: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   61 |     bubble(n, c1, b1);
      |               ^~
      |               |
      |               char*
a.cc:61:11: error: too many arguments to function 'int bubble(int, int)'
   61 |     bubble(n, c1, b1);
      |     ~~~~~~^~~~~~~~~~~
a.cc:5:5: note: declared here
    5 | int bubble(int n, vector<char> a, vector<int> b){
      |     ^~~~~~
a.cc:62:18: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   62 |     selection(n, c, b);
      |                  ^
      |                  |
      |                  char*
a.cc:62:14: error: too many arguments to function 'int selection(int, int)'
   62 |     selection(n, c, b);
      |     ~~~~~~~~~^~~~~~~~~
a.cc:16:5: note: declared here
   16 | int selection(int n, vector<char> a, vector<int> b){
      |     ^~~~~~~~~