Language: C++

#include<iostream>

int bubbleSort(int[], int N) {
	int sw = 0;
	bool flag = true;
	for (i = 0; i < N; i++) {
		flag = false;
		for (int j = 0; j < N - 1; j++) {
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				flag = true;
				sw++;
			}
		}
	}
	return sw;
}

int main()
{
	int A[100], N, sw;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sw = bubbleSort(A, N);
	for (int i = 0; i < N; i++) {
		if (i)cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:6:14: error: 'i' was not declared in this scope
    6 |         for (i = 0; i < N; i++) {
      |              ^
a.cc:9:29: error: 'A' was not declared in this scope
    9 |                         if (A[j] < A[j - 1]) {
      |                             ^
a.cc:10:33: error: 'swap' was not declared in this scope
   10 |                                 swap(A[j], A[j - 1]);
      |                                 ^~~~
a.cc:10:33: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 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/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
a.cc: In function 'int main()':
a.cc:22:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   22 |         cin >> N;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:26:23: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |                 if (i)cout << " ";
      |                       ^~~~
      |                       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |                 cout << A[i];
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |         cout << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:29:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |         cout << endl;
      |                 ^~~~
      |                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~