Lab7 - /* init_array(rain): setrto0 whiler

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/*  init_array(rain):  set r to 0  while r < ROWS  set c to 0  while c < COLS  set rain[r][c] to 0  set c to c + 1  set r to r + 1  end  add_rain(rain):  set r to 0  while r < ROWS  set c to 0  while c < COLS  set rain[r][c] to rain[r][c] + rand_double(0, 4)  set c to c + 1  set r to r + 1  end  print_rain(rain):  set r to 0  while r < ROWS  set c to 0  while c < COLS  print rain[r][c]  set c to c + 1  print '\n'  set r to r + 1  end  draw_map(rain):  set r to 0  while r < ROWS  set c to 0 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
while c < COLS  if rain[r][c] <= 12 then  print '.'  else  print 'X'  set c to c + 1  print '\n'  set r to r + 1  end  main:  read seed, days  call srand( seed )  call init_array( rainfall )  set k to 1  while k <= days  print k  add_rain( rainfall )  print_rain( rainfall )  set k to k+1  call draw_map( rainfall )  end 
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/29/2011 for the course CIS 209 taught by Professor Aren during the Spring '11 term at Kansas State University.

Page1 / 5

Lab7 - /* init_array(rain): setrto0 whiler

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online