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";
}

Er nevermind, couldn't see that last bracket.

Hello..... i got a problem where my output are repeated.....
how to solve this problem....

Er nevermind, couldn't see that last bracket.

Good. I'm glad you got it because you didn't tell us what the problem was which makes it hard to help you to solve it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.