#include<iostream.h> #include<conio.h> void print_array_single_line(int [3][4]); void print_array_row_by_row(int [3][4]); int sum_array(int [3][4]); main() { clrscr(); int array[3][4]={ {5,10,15,20},{25,30,35,40},{45,50,55,60} }; cout<<\"\\n The contents of the array along a singal line :\"<<endl; print_array_single_line(array); cout<<\"\\n\\n\\n The contents of the array row by row :\"<<endl; print_array_row_by_row(array); cout<<\"\\n\\n\\n Sum of the array is = \"<<sum_array(array)<<endl; getch(); return 0; } //------------------ print_array_single_line(int [3][4]) --------------// void print_array_single_line(int array[3][4]) { for(int count_1=0;count_1<3;count_1++) { for(int count_2=0;count_2<4;count_2++) cout<<\" \"<<array[count_1][count_2]; } } //----------------- print_array_row_by_row(int [3][4]) ----------------// void print_array_row_by_row(int array[3][4]) { for(int count_1=0;count_1<3;count_1++) { for(int count_2=0;count_2<4;count_2++) cout<<\" \"<<array[count_1][count_2]; cout<<endl; } } //------------------------- sum_array(int [3][4]) ---------------------// int sum_array(int array[3][4]) { int sum=0; for(int count_1=0;count_1<3;count_1++) { for(int count_2=0;count_2<4;count_2++) sum+=array[count_1][count_2]; } return sum; }