Nice question, although I don't see what the real application is. When I understood your question correctly, you want to compute only the first n terms of
A[i][0]=x+y;
A[i][1]=x*x+3*y;
A[i][2]=x+2*y*x;
……
A[i][99]=x/2+20*y;
thus n being the limit for j. Correct?
There are (at least) two principal approaches of how you can go about that:
(1) Interspersing if statements
while (1)
{
if (0 >= n) break;
A[i][0]=x+y;
if (1 >= n) break;
A[i][1]=x*x+3*y;
if (2 >= n) break;
A[i][2]=x+2*y*x;
……
if (99 >= n) break;
A[i][99]=x/2+20*y;
break;
}
That is not elegant, but probably faster than approach number 2:
(2) Placing the arithmetic terms in an array of functions and then looping over that array.
typedef double PolyFunc (double x, double y);
double f0 (double x, double y)
{return x + y;}
double f1 (double x, double y)
{return x*x + 3*y;}
...
static PolyFunc* sFunctions[100] = {&f0, &f1, ...};
void ComputeArray (int n)
{
...
for (int j = 0; j < n; ++j)
A[i][j] = sFunctions[j] (x, y);
}
Hope that helps.