Language: C++

#include<iostream>
using namespace std;

const int size=999;
void swop(const int list[],int n);

int main()
{
	int m,list[size];
	cin>>m;
	for(int j=0;;j++)
	{
		cin>>list[j];
		if(getchar()=='\n')
			break;
	}
	for (int a=1;a<m+1;a++)
		swop(list,a);
	for (int k=0;k<j+1;k++)
		cout<<list[k]<<" ";
	cout<<endl;
	system("pause");
	return 0;
}

void swop(const int list[],int n)
{
	int temp,a,j;
	if(a==2)
	{
		temp=list[0];
		list[0]=list[1];
		list[1]=temp;
	}
	else if(a>2)
	{
		temp=list[a-1];
		for (;a>1;a--)
			list[a-1]=list[a-2];
		list[0]=temp;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: reference to 'size' is ambiguous
    9 |         int m,list[size];
      |                    ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:11: note:                 'const int size'
    4 | const int size=999;
      |           ^~~~
a.cc:13:22: error: 'list' was not declared in this scope
   13 |                 cin>>list[j];
      |                      ^~~~
a.cc:2:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
    1 | #include<iostream>
  +++ |+#include <list>
    2 | using namespace std;
a.cc:18:22: error: 'list' was not declared in this scope
   18 |                 swop(list,a);
      |                      ^~~~
a.cc:18:22: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
a.cc:19:24: error: 'j' was not declared in this scope
   19 |         for (int k=0;k<j+1;k++)
      |                        ^
a.cc:20:23: error: 'list' was not declared in this scope
   20 |                 cout<<list[k]<<" ";
      |                       ^~~~
a.cc:20:23: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
a.cc: In function 'void swop(const int*, int)':
a.cc:32:24: error: assignment of read-only location '* list'
   32 |                 list[0]=list[1];
      |                 ~~~~~~~^~~~~~~~
a.cc:33:24: error: assignment of read-only location '*(list + 4)'
   33 |                 list[1]=temp;
      |                 ~~~~~~~^~~~~
a.cc:39:34: error: assignment of read-only location '*(list + (((sizetype)(((long unsigned int)a) * 4)) + 18446744073709551612))'
   39 |                         list[a-1]=list[a-2];
      |                         ~~~~~~~~~^~~~~~~~~~
a.cc:40:24: error: assignment of read-only location '* list'
   40 |                 list[0]=temp;
      |                 ~~~~~~~^~~~~