shamila08 0 Junior Poster in Training

hello, dear all

#include <iostream>
#include <stdio.h>
using namespace std;
int count = 1;

void print( int *arr,  int SIZE){
  if (arr != 0) {
    for (int i = 0; i < SIZE; i++) { // i = position
      cout <<  arr[i];
    }
    cout <<"\n";
  }
}  
void circular_left(int *arr, int start, int SIZE)
{
 int tmp = arr[start];                               //i is a position
for(int i = start; i<= SIZE-1; i++){
	arr[i]= arr[i+1];
	}
arr[SIZE-1] = tmp;
}
void starterequiv(int *arr,  int start, int SIZE)
{	int i, j;
	print(arr, SIZE);
	if (start < SIZE) 
	{  
    for (i = SIZE-1; i > start; i--) 
	{// outer loop
      for (j = i+1 ; j < SIZE; j++)
	  { // inner loop
	circular_left(arr,i, SIZE);
		starterequiv(arr, i, SIZE);
		count++;
      } //end inner loop
	 circular_left(arr,i,SIZE);
		} // end outer loop
	}
	
}

void initiate(int *arr, int SIZE)
{
  for (int i = 0; i <SIZE; i++) {   // i is a position
    arr[i] = i+1;
  }
} // init


int main()
{
  int SIZE;
  cout << "Enter the number of elements: ";    //SIZE = n
  cin >> SIZE;

  if (SIZE > 0 && SIZE <= 100) {
    int *arr = new int[SIZE];
    initiate(arr, SIZE);
      starterequiv(arr,0,SIZE);
	delete [] arr;
	cout << "No. Permutation :" << count; 
	cout << endl;
  }
}

and then the output as follows:

Enter the number of elements: 4
1234
1243
1342
1324
1423
1432
No. Permutation :6
Press any key to continue . . .

Actually i need that as my output which at position 1, the element '1' is fixed as a head.
then i just wondering about this routine

void starterequiv(int *arr,  int start, int SIZE)
{	int i, j;
	print(arr, SIZE);
	if (start < SIZE) 
	{  
    for (i = SIZE-1; i > start; i--) 
	{// outer loop
      for (j = i+1 ; j < SIZE; j++)
	  { // inner loop
	circular_left(arr,i, SIZE);
		starterequiv(arr, i, SIZE);
		count++;
      } //end inner loop
	 circular_left(arr,i,SIZE);
		} // end outer loop
	}	
}

with the loop 'j'

for (j = i+1 ; j < SIZE; j++)

i'm try to throw it but the output is weird. if i left it, i couldn't find where i use 'j' in my algorithm. please help me. i just cycle left all those element exclude '1' to generate next (n-1)! array. it something similar to permutation but unfortunately it is not.