Why doesn’t this code compile

You’re missing your inner for loop and your cout after the double for loop is missing a second carrot. Should probably look something like this:

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++)
    {
        for(j=0; j<NUMCOLS;j++)
        {
            val[i][j]=val[i][j]*10;
        }//end of inner loop
    }//end of outer loop
    cout<<endl; 
    return 0; 
}

Leave a Comment