I need to check the combination of my boolean functions which actually are situations that may happen in chart and are in extern. let you explain it by an example.
I have 10 different functions that their names are OPT1, OPT2,.... OPT10.
to check them I have to make groups of them, So I have to check them in different levels. in first level, for the example, we have maximum of 5 group.
the number of groups in each level is MathCeil((last group number after first level or number of functions for first level)/2)
in each group I need to check three situations: 1. "All of the values in the group are true" 2."One of the Values in the group is true" 3. "None of the values in the group are true."
I write a while in while in while code but it was a mess.
is it possible to code a universal function for this application if I have more functions but knows the number of functions ?
If anybody knows how to code this, please help me.
set a variable to zero
check each condition and increase the variable if the condition is true
check whether the variable == 5,1 or 0
Thank you for your reply,
I think I couldn't tell you my meaning. this is not my problem, the problem is how to count a series of variable that contain continuous numbers.
for example I have 5 situations;
I get the group number of levels of each situation from input and type of each group from extern input,
// group numbers of level 1 from input (up to 3 groups)
GSit1L1 = 1,GSit2L1 = 3,GSit3L1 = 2,GSit4L1 = 3,GSit5L1 = 2;
// group numbers of level 2 from input (up to 2 groups)
GSit1L2 = 4,GSit2L2 = 5,GSit3L2 = 4,GSit4L2 = 5,GSit5L2 = 4;
//group types from input (-1,0,1,2)
GT1 = -1,GT2 = 2,GT3 = 2,GT4 = 1,GT5 = 1
So if I could count the members of each group and the number of situations that belong to a group, then I can compare and find the result.
I asked a C programmer who doesn't listen carefully and he said it is impossible, another one said you can count a series of variable that contain continuous numbers with arrays, but I don't know how;
or do you have another way to handle it ?
just tell me how to count a series of variable that contain continuous numbers in a "for" loop .
GSit1L1 = 1,
GSit2L1 = 3,
GSit3L1 = 2,
GSit4L1 = 3,
GSit5L1 = 2
GT1 = -1,
GT2 = 2,
GT3 = 2,
GT4 = 1,
GT5 = 1
int GML1 ()
for (int i=GSit1L1; ; ++)
To add comments, please log in or register