+ 3
C++ comparison/boolean-logic
How to compare multiple variables with a number? For example: Is there something like this if ( (a,b,c,d,e)>10 ) instead of if ( a>10 || b>10 || c>10 || d>10 || e>10 )
2 Answers
+ 6
Don't know if it makes it easier in your case, but maybe loop over the values?
int a=5, b=7, c=11, d=17, e=3;
for(int n: {a, b, c, d, e})
if (n>10)
cout << n << endl;
+ 2
You can use a for loop on a fixed dimension array and return the resulting output in another arrayš¤