Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(k = 0; k < NUMSTEPS; k++)
- {
- printf("Step: %d\n", k);
- for (i = 1; i < (Y + 1); i++)
- {
- for (j = 1; j < (X + 1); j++)
- {
- if (cycleSwitch == 0)
- {
- resultArray[i][j] = ((sourceArray[i][j] + sourceArray[i][(j - 1)] + sourceArray[i][(j + 1)] + sourceArray[(i - 1)][j] + sourceArray[(i + 1)][j]) / 5);
- }
- else
- {
- sourceArray[i][j] = ((resultArray[i][j] + resultArray[i][(j - 1)] + resultArray[i][(j + 1)] + resultArray[(i - 1)][j] + resultArray[(i + 1)][j]) / 5);
- }
- }
- }
- if(cycleSwitch == 0)
- {
- cycleSwitch = 1;
- }
- else
- {
- cycleSwitch = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement