Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please, help me correct my program because I can\'t get it to run. Something is

ID: 3761843 • Letter: P

Question

Please, help me correct my program because I can't get it to run. Something is wrong but I don't know what it is.

/*
ELEN 1301-02 Programming Assignment #11.
Due date : November 12, 2015
Purpose of the program:
Section 1 Set a random number seed with 2 followed by the last 3
digits of your student ID.
Section 2 Place mines in your field. Around 10 % of the field should
be mines.
Section 3 Find the number of mines in the 8 surrounding areas.
Section 4 Display the mine field. Mine should be represented by “#”
and other areas should be shown with the number of mines nearby.
*/

#include<iostream>
#include<ctime>
using namespace std;

void main()
{
   int i, j, k,m ,n;
   const int numRows = 25;
   const int numCols =25;
  
   srand(2185);
       int val[numRows][numCols];

   for (i=0; i< numRows ; i++)
       for(j=0; j < numCols; j++)
           val[i][j] = 0;

for (i=0; i<int (numRows*numCols*0.1) ; i++)
   val[rand() % numRows][rand() % numCols] = -1;
/*
for (i=0; i<numRows ;i++)
{
for (j=0 ; j<numCols; j++)

   if (val[i][j] == -1)
   cout<<"# ";
   else
   cout <<". ";
   cout << endl;
}
   */
  
   for (i=0 ; i< numRows; i++)
       for (j=0 ; j<numCols; j++)
       {
           if (val[i][j] ==1)
               continue;
           k = 0;

           for(m = i-1; m<=i+1 ; m++)
               for (n= j-1; n<= j+1; n++)
               {
                   if (n<0 || n<0 || n>=numRows|| n>=numCols)
                       continue;
                   if (val[m][n] == -1)
                       k++;
               }
               val[i][j] = k ;
       }

   for (i=0 ; i<numRows; i++)
   {
       for(j=0 ; j<numCols; j++)
             
           if (val[i][j] ==-1)
               cout<<"# ";
           else
               cout<< val[i][j] <<" ";
       cout << endl;
   }
}// main
                 
                      

Explanation / Answer

#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<fstream>
#include<string>
using namespace std;
int surround();
int main ()
{
           unsigned int id=2185;
           srand(id);
           int arrayCount[6]={0};
           for(int index11=0;index11<200;index11++)
           arrayCount[surround()]++;
           for(int index12=1;index12<=5;index12++)
    {
        for(int index13=0;index13<arrayCount[index12];index13++)
        cout<<"#";
        cout<<"."<<endl;
    }
    int numberSum=0;
    for(int index12=0;index12<8;index12++)    
            numberSum=+surround();
    cout<<"The Total sum of adding roll for 8 times "<<numberSum<<endl;
    int arrayCount2[6]={0};
    for(int index11=0;index11<1000000;index11++)
        arrayCount2[surround()]++;
    for(int index12=1;index12<=5;index12++)
    {
        int countnumber=arrayCount2[index12]/2000;
        for(int index13=0;index13<countnumber;index13++)
            cout<<"#";
           cout<<"."<<endl;
    }
    system("PAUSE");
    return 0;
}

int surround()
{
    srand(time(NULL));
    return rand()%5+1;
}