Why Did This Program Not Complie – C++

#include <iostream>
#include<iomanip>
using namespace std; 
int main()
{
    const int NUMROWS=3; 
    const int NUMCOLS=4;
    int i,j; 
    int val[NUMROWS][NUMCOLS]={8,16,9,52,27,6,14,25,2,10};//multiply each element by 10 and display it 
    cout<<"nDisplay or multiplied elements"; 
    for(i=0; i<NUMROWS;i++)
    {
        val[i][j]=val[i][j]*10;
    }//end of inner loop
    }//end of outer loop
    cout<endl; 
    return 0; 
    }

These are the errors I received. What have I done wrong 16:5: error: ‘cout’ does not name a type
17:5: error: expected unqualified-id before ‘return’
18:5: error: expected declaration before ‘}’ token


Source: c++

Leave a Reply