### Calculate median from 2 dimensional array.

I am having trouble figuring out why I am getting the following error. I'm also attaching the section of code I'm working on. A nudge in the right direction would be appreciated.

Error: cannot covert 'double[5]' to 'double' in assignment.

 ``123456789`` `````` bubblesort(bowlers,11,scores,11); if(rows%2==0) {//top of if median=(scores[rows/2]+scores[rows/2]-1)/2; }//bottom of if else {//top of else median=scores[rows/2]; }//bottom of else ``````
You really haven't shown enough code. However from your title, I'm implying that scores is a 2 dimensional array. I'm also guessing that median is a simple double, not an array. If those assumptions are correct, then at lines 4 and 8 you're trying to assign a 1D array (scores[n]) to a simple double.

You are right. I have figured out the error, however, the median is not returning the correct value. the adjusted code is:

 ``12345678`` `````` if(scores[r][c%2]==0) {//top of if median=(scores[r][c/2]+scores[r][c/2]-1)/2; }//bottom of if else {//top of else median=scores[r][c/2]; }//bottom of else ``````

Here are my declarations.
 ``1234567`` ``````int r=0,c=0,rows=10,cols=3; void bubblesort(string arry[],int length,double scores2[][5],int length2); int main(int argc, char** argv) ifstream infile; string bowlers[20]; double scores[20][5]; double median=0.0;``````
Here is the whole code, minus the sort function.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117`` ``````using namespace std; int r=0,c=0,rows=10,cols=3; void bubblesort(string arry[],int length,double scores2[][5],int length2); int main(int argc, char** argv) {//top of main ifstream infile; string bowlers[20]; double scores[20][5]; double median=0.0; int pos=0; cout<>scores[r][c]; }//bottom of c read infile.ignore(100,'\n'); }//bottom of r read infile.close(); //calculate average for(r=1;r<=rows;r++) {//top of r average across for for(c=1;c<=cols;c++) {//top of c average across for scores[r][4]=scores[r][4]+scores[r][c]; }//end of c average across for scores[r][4]=scores[r][4]/3.0; }//end of r average across for //average down for(c=1;c<=cols;c++) {//top of c average down for for(r=1;r<=rows;r++) {//top of r average down for scores[11][c]=scores[11][c]+scores[r][c]; }//end of r average down for scores[11][c]=scores[11][c]/10.0; }//end of c average down for //Print Loop bowlers[11]="Average Score"; for(int r=1;r<=11;r++) {//top of r print cout<highest) {//top of highest if highest=scores[r][4]; highname=bowlers[r]; }//end of highest if }//end of highest for bubblesort(bowlers,11,scores,11); if(scores[r][c%2]==0) {//top of if median=(scores[r][c/2]+scores[r][c/2]-1)/2; }//bottom of if else {//top of else median=scores[r][c/2]; }//bottom of else cout<<"\n"; //Print Loop for(int r=1;r<=11;r++) {//top of r print cout<