Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bingo Example: Design (Print Card Algorithm)

Similar presentations


Presentation on theme: "Bingo Example: Design (Print Card Algorithm)"— Presentation transcript:

1 Bingo Example: Design (Print Card Algorithm)
J. Michael Moore CSCE 121

2 Design Console constrains output to characters only.
Use a 2D (2 dimensional) homogeneous compound data structure that we can index into (e.g. an array or vector) Recall that most homogeneous compound data structures in computers have zero based indexes. 1 2 3 4 B I N G O F

3 Design We want to store numbers, but how to represent the free spot? Use a negative value Largest number is 2 digits so use 2 places for all numbers Space between each column Console uses monospaced fonts so alignment works with just spaces Note that if we prepend a space to the first column each column is 3 characters wide including the space in the front. Example output B I N G O 7 22 F 49 62

4 Overall Fill card with values (we’ll see later)
Print Column Labels (i.e. BINGO) Print the values where each letter is right justified with 3 spaces Print values (use row major order) For each row (values 0-4) For each col (values 0-4) Output card[row][col] right justified with 3 spaces New line


Download ppt "Bingo Example: Design (Print Card Algorithm)"

Similar presentations


Ads by Google