C++ Array Two-Dimensional Arrays, Multiply each element by 10 and display it
#include <iostream> #include <iomanip> using namespace std; int main()/*from w w w .ja va2 s. co m*/ { const int NUMROWS = 3; const int NUMCOLS = 4; int i, j; int val[NUMROWS][NUMCOLS] = {8,6,9,52, 3,5,2,6, 4,2,2,1}; cout << "\nDisplay of multiplied elements"; for (i = 0; i < NUMROWS; i++) { cout << endl; // start each row on a new line for (j = 0; j < NUMCOLS; j++) { val[i][j] = val[i][j] * 10; cout << setw(5) << val[i][j]; } } cout << endl; return 0; }