hey,i was just tryin my hand at this program which prints all the possible permutations of a number and m stuck up wid d code.
the code i wrote was:
please tel me what changes to make in the codeCode:#include<iostream.h> #include<conio.h> int x; void main() { int arr[20],num; cout<<"enter the number of digits:"<<endl; cin>>num; cout<<"enter the number:"<<endl; for(int i=0;i<num;i++) { cin>>arr[i]; } for(int j=0;j<num;j++) { for(int k=0;k<num;k++) { for(int l=0;l<num;l++) { cout<<endl; cout<<arr[l]; } x=arr[num-1]; for(int m=0;m<num-1;m++) { arr[m+1]=arr[m]; } arr[j]=x; } } getch(); }



LinkBack URL
About LinkBacks


