Undesired output in program

I am trying to create a program which will output all possibilities of a set of variables (number of which is set by user), and a range of different integer possibilities (given by the user).

Basically, like this:

How many variables: 5

How many different values [1 < x <= 12]: 2

1 1 1 1 1
1 1 1 1 2
1 1 1 2 1
1 1 1 2 2
1 1 2 1 1
1 1 2 1 2
1 1 2 2 1
1 1 2 2 2
1 2 1 1 1
1 2 1 1 2
1 2 1 2 1
1 2 1 2 2
1 2 2 1 1
1 2 2 1 2
1 2 2 2 1
1 2 2 2 2
2 1 1 1 1
2 1 1 1 2
2 1 1 2 1
2 1 1 2 2
2 1 2 1 1
2 1 2 1 2
2 1 2 2 1
2 1 2 2 2
2 2 1 1 1
2 2 1 1 2
2 2 1 2 1
2 2 1 2 2
2 2 2 1 1
2 2 2 1 2
2 2 2 2 1
2 2 2 2 2


So far, I've only tried 5 variables by 2 values per variable.
6 x 2 gives me the correct number of variables, but with all numbers == 1 on every single output.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <cmath>

using namespace std;

void incrementToValue(int*, int, int, int);

int main()
{
	int numVars, // how many variables
		highestAmount, // Highest amount a variable can store.
		numCombos,
		currentNum = 1;
	int * combos;
	
	cout << "How many variables: ";
	cin >> numVars;
	cout << "How many different values [1 < x <= 12]: ";
	cin >> highestAmount;
	numCombos = (int)(pow(highestAmount, numVars));
	combos = new int[numVars];
	for (int i = 0; i < numVars; i++)
	{
		combos[i] = 0; // initialize all vars to zero.
	}

	for (int i = 0; i < numCombos; i++)
	{
		incrementToValue(combos, numVars, highestAmount, i);
	}


	delete[] combos;
	return 0;
}


void incrementToValue(int * combos, int numVars, int highestAmount, int numToIncrement)
{
	int val;

	for (int i = numVars - 1; i >= 0; i--)
	{ //                     12 / (5^0)
		val = (((numToIncrement / (int)(pow(highestAmount, i))) * numVars) % highestAmount);
		cout << val + 1 << "\t";
	}
	cout << endl;
}

I'm sure the problem lies in the incrementToValue() function.

Any help would be greatly appreciated. Thanks.
Topic archived. No new replies allowed.