#include<iostream>
using namespace std;
int main()
{
// declared and initialized the 2d array
int arr2d[3][4] = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}};
int i, j;
system("cls");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 4; j++)
{
cout << arr2d[i][j] << "\t";
}
cout << endl;
}
system("pause");
}
This is my (professor's) code. I'm still a newbie to C++ tho (1st year student in college actually). I want to know a simple and really basic code that will help me to get the sum of all the values I declared and initialized in the 2D array. :)
*BTW I'm using Dev Bloodshed C++ 4.9.9.2