首页 未分类

include <iostream>

using namespace std;

// 实现输入的数最后一位移到最左边

int main()
{

int n;

cin >> n;
int *a = new int[n+1];

int i,temp;
for (i=1;i<=n;i++)
{
    cin >> a[i];
}

temp = a[n];
for (i=n-1;i>=1;i--)
{
    a[i+1] = a[i];
}

a[1] = temp;
for(i=1;i<=n;i++)
{
    cout << a[i] << " ";
}

return 0;

}



文章评论