0

Hello..... i got a problem where my output are repeated.....

how to solve this problem....

```
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define MAX 100
int num[MAX];
int n;
int nrows = 0;
int temp =2;
using namespace std;
void print()
{
if (num != 0) {
for (int i = 0; i <n; i++)
cout << num[i]<<"\t";
// cout << "num["<<j<<"]=" <<num[j] << endl;
cout <<"\n";
}
cout << "\n";
}
void rightRotate ( int n)
{int tmp;
for(int k =0; k<n-1; ++k)
{
//cout << "l:"<< l << "\n";
tmp = num[k];
num[k]= num[k+1];
num[k+1] = tmp;}
}
void matrixPermute (int k)
{
int i;
k = temp;
if (temp == n-1 )
{nrows++;
print();
return;
}
temp = temp+1;
cout << "temp:"<< temp<<"\n";
for (i = 0; i <temp ; ++i)
{
//cout << "i:" << i << "\n";
rightRotate (temp);
matrixPermute (temp);
}
}
void initiate(int n)
{
for (int i = 0; i < n; ++i)
{
num[i] = i+1;
}
}
int main ()
{
cout << "number must be between 3 and 10 \n";
cin >> n;
cout << endl;
initiate(n);
matrixPermute (n);
cout << "nrows=" <<nrows << "\n";
}
```