0
Why 3 array consists of identical numbers?
i have 1 task: 2 arrays are given. Get 3 array of half-sum of 2 data. const int N=10;//max array size int AVec[N];//1 array int BVec[N];// 2 array int i = 0;//index int j = 0;//index int CVec[N];//3 array int k = 0;//index for (k = 0; k <N ; k++) { for (i = 0; i < N; i++) { for (j = 0; j < N; j++) { CVec[k] = (AVec[i] + BVec[j]) / 2; }//for j }//for i }//for k cout « "Print 3 array\n"; for (k = 0; k<N; k++) { cout « CVec[k] « " " ; }//for k
1 Antwort
0
that is, this cycle is true?
for (k = 0; k <N ; k++)
{
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
CVec[k] = (AVec[i] + BVec[j]) / 2;
}//for j
}//for i
}//for k