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

Flowchart of this program please. ELEN 1301-02 Programming Assignment #10 Name D

ID: 3760101 • Letter: F

Question

Flowchart of this program please.

ELEN 1301-02 Programming Assignment #10 Name Domingos Messa Student ID :L20383185 Due date November 5, 2015 Purpose of the program Create a program that places mines in the 25 X 25 field and display it 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 Display the mine field. Mine should be represented by “#” and other areas should be shown with #include using namespace std; void main() int x, y; char MineField[25] [25]; // array for( int i 0; i

Explanation / Answer

#include<stdio.h>
#include<conio.h>

void main()
{
   int x,y,i,j;

   char MineField[25][25];

   for(i=0;i<25;i++)
       for(j=0;j<25;j++)
           MineField[i][j]='.';

   srand(2185);

   for(i=0;i<25*25*0.1;i++)
   {
       x=rand()%25;
       y=rand()%25;

       MineField[x][y]='#';
   }

   for(i=0;i<25;i++)
   {
       for(j=0;j<25;j++)
       {
           printf("%c",MineField[i][j]);
       }
       printf(" ");
   }
   getch();
}