So I want to print the same result in the screen, but in this case like one matrice[i][j], because then my program have continue with matrice, not with function. Many Thanks!
The function : procesar give me the next result in the screen:
Expand|Select|Wrap|Line Numbers
- 123
- 213
- 231
- 321
- 312
- 132
cout<<" The converted matrice is :"<<matriz[i][j];
Because the previos results it appear like one function:procesar(n,C)
The code of the combination function is :
Expand|Select|Wrap|Line Numbers
- #include <iostream.h>
- #include <conio.h>
- using namespace std;
- int procesar(int n, int C[])
- {
- int i;
- int inc = 0;
- int it = n * (n - 1);
- while (inc < it)
- {
- for (i = n - 1; i > 0; i--)
- {
- int aux = C[i-1];
- C[i-1] = C[i];
- C[i] = aux;
- for (int j = 0; j < n; j++)
- cout <<" "<< C[j];
- cout << endl;
- inc++;
- }}}
- int main()
- {
- int n;
- cout << "How many numbers of digits you want to use for a combination: ";
- cin >> n;
- int C[n];
- for (int i = 0; i < n; i++)
- {
- cout << "Input digit: " << i + 1 << ": ";
- cin >> C[i];
- }
- procesar(n, C);
- getch();
- return 0;
- }