210 likes | 340 Views
Row Average (2D Array). void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; }.
E N D
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; }
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=?
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=? total=0.0
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=0 total=0.0
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=0 total=0.0
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=0 total=21.3
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=1 total=21.3
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=1 total=21.3
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=1 total=21.3
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=2 total=48.7
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=2 total=48.7
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=2 total=73.2
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=3 total=73.2
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=3 total=73.2
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=3 total=99.0
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=4 total=99.0
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j; float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=4 total=99.0
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=4 total=99.0 Row 1 Average=24.8
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=4 total=99.0 Row 1 Average=24.8
Row Average (2D Array) void RowAverage(float x[ ][4], int i) { int j float total=0.0; for(j=0;j<4;j++) { total=total+x[i][j]; } cout<<“Row”<<j<<“Average=”<<total/4.0<<endl; return; } 0 1 2 3 12.6 15.6 16.2 13.5 0 21.3 24.5 25.8 x 1 27.4 33.2 31.5 37.1 32.7 2 i=1 j=4 total=99.0 Row 1 Average=24.8