C++ Learn To Program – C++ Multidimensional Arrays & Loops to Create Patterns – Pt2: C++ Reading Text File

Share it with your friends Like

Thanks! Share it with your friends!


C++ College Exercise: Using Multidimensional Arrays and Loops to Create Patterns Part 2 of 9: C++ Reading Text File

Implement multi-dimensional arrays
Additional interaction with file I/O

The pattern will be held in a 15 x 15 multi-dimensional array
There are 6 different patterns
1. Box
2. Letter X
3. Plus sign
4. Bordered Letter X – box around the x
5. Bordered plus sign – box around the plus
6. Checkerboard

– The pattern can be filled in with any character
– Fill in the grid with the given character
– Print the array to the file
– All patterns must be created using nested loops.
– Validate the pattern number
-If the pattern number is invalid, print an error message
– Comment your code generously. Refer to the grading rubric for more details
– Use as few variables as possible. Don’t waste memory holding a calculation just so you can print
it out one time.
– Program must have at least 3 functions other than main
– The function chain cannot be more than 2 levels deep

– All input will be read from a file named input.txt.
– All input will be the proper format and within the proper range for the data type.
– Each line will contain 2 pieces of information
– The pattern number
– The fill character
– The format of each line will be:
– [pattern numbe][space][fill character][new line]
– The last line in the file will not contain a new line character.

– All output will be written to a file named patterns.txt.
– Each pattern will be drawn to the file using the specified fill character
– Print 2 blank lines between each pattern/error message



Write a comment