Hey guys,
I will sketch my problem.
My simplified code looks like this:
Code:
int permutations[3][4] = {
{number[0], number[1], number[2], number[3]} ,
{number[0], number[1], number[3], number[2]} ,
{number[0], number[2], number[1], number[3]}
}
void functionx(int number[]) {
for (i = 0; i < 3; i++) {
/* here is where I have no clue what to do */
if(number[0] * number[1] - number[2] + number[3] == 10l) {
printf("(%d * %d - %d + %d)", number[0], number[1], number[2], number[3]);
break;
}
}
int main(int argc, char*argv[]) {
int number[4];
int i;
for(i=0; i<3; i++){
scanf("%d", &number[i]);
}
functionx(number);
return 0;
}
So in the part from the comment I need some code to assign the vallue of the 2d array to the numbers. Example:
Input: 1 2 3 4
Then the first time it goes through the loop in functionx, number[0] has to be 1, number[1] 2, number[3] 3 and number[4] 4. The second time it has to change the place of number[3] and number[4] etcetera.
How can I achieve this?
I hope the idea is clear.
Kind regards,
Gertjan