Rotation of an array . Need suggestions with the code :  THIS IS A C++ CODE AND I FEEL ITS CORRECT ,YET IT DOESN'T WORK.I WILL EXPLAIN A BIT FOR UNDERSTANDING , //int t IS FOR NO OF TRIES. //int n IS for size of array. //int k is for no of rotation. INPUT 1 2 3 4 5 and if k=2 then OUTPUT 4 5 1 2 3. // PLEASE ADVICE ON THE SAME.

    enter code here

  
     #include<iostream>
    using namespace std;
    int main()
    {
    int t;
    cin>>t;
    int n;
    int k;
    int s=0;
    int a[1000];
    int b[1000];
    for(int i=0;i<t;i++)
    {
    cin>>n;
    cin>>k;
    for(int j=0;j<n;j++)
    {
    cin>>a[j];
    cout<<" ";
    }
    for(int y=0;y<n;y++)
    {
    b[y+k]=a[y];
    if(y+k>=n)
    {
    b[s]=a[y];
    s++;
    }
    cout<<b[y]<<" ";
    }
    }
    return 0;
    }