Lab #11: Magic Square
This is due at the end of lab today.
Objective: Write up the Magic Square program and add error checking to it.
Reference: Class Lecture on Monday, April 20, 2015
Lab: 1. Using your notes from class, type up the Magic Square program.
2. When you have that working correctly then add the code to check the calculations. You want to confirm that all rows and columns add up to the same value. Output one simple line: either “YES they all add up to the same value” or “NO there is a problem Houston”. Use a boolean variable to do this.
3. Bonus (10 points) – Include the code to check the diagonals of the matrix also.
Output: The output will be the Magic Square and the statement that all rows and columns add up or they do not.
When you have successfully completed the entire lab:
1. Flag down the instructor or lab assistant.
2. Demonstrate that your code executes correctly without any errors.
3. Turn in the hard copy of your original source code and a copy of the output data file. Run the program for a Magic Square of size 15 x 15, user input value of 15.
You will be graded on:
·
2
· Good programming style (10)
· Comments (10)
· Neat and readable (10)
· Logic (10)
· Array Manipulation(10)
· Other (10)
· Loops (10)
· Output (10)
· Arrays (10)
· Error checking (10)
· Bonus Check (10)