help me solve this in c++ please  Write a program that asks the user to enter a list of numbers from 1 to 9 in random order, creates and displays the corresponding 3 by 3 square, and determines whether the resulting square is a Lo Shu Magic Square. Notes Create the square by filling the numbers entered from left to right, top to bottom. Input validation - Do not accept numbers outside the range. Do not accept repeats.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 4RQ
icon
Related questions
Question

help me solve this in c++ please 

Write a program that asks the user to enter a list of numbers from 1 to 9 in random order, creates and displays the corresponding 3 by 3 square, and determines whether the resulting square is a Lo Shu Magic Square.

Notes

  • Create the square by filling the numbers entered from left to right, top to bottom.
  • Input validation - Do not accept numbers outside the range. Do not accept repeats.
  • Must use two-dimensional arrays in the implementation.
  • Functional decomposition — Program should rely on functions that are consistent with the algorithm.
Lo-Shu Magic Square
loShu.cpp
The Lo Shu Magic Square is a grid with 3 rows and 3 columns as shown below:
492
357
816
The grid contains the numbers 1 through 9 exactly.
The sum of each row, each column, and each diagonal all add up to the same number:
15
492 15
357 15
8 16 15
15
15 15 15
Transcribed Image Text:Lo-Shu Magic Square loShu.cpp The Lo Shu Magic Square is a grid with 3 rows and 3 columns as shown below: 492 357 816 The grid contains the numbers 1 through 9 exactly. The sum of each row, each column, and each diagonal all add up to the same number: 15 492 15 357 15 8 16 15 15 15 15 15
Input Validation
Microsoft Visual Studio Debug Console
Lo Shu Magic Square
Creating Lo Shu Square
Enter Nine Numbers (1-9)
Number 1: 1
Number 2: 2
Number 3: 2
Error ...
2 is already in the Lo Shu Square. Try again
Number 3: 3
Number 4: 4
Number 5: 5
Number 6: 10
Error ... Invalid number. Try again
Number 6: 6
Number 7: 7
Number 8: 8
Number 9: 9
|| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
Sorry ... this is not a Lo Shu Magic Square
Would you like to try again (y/n)? n
Transcribed Image Text:Input Validation Microsoft Visual Studio Debug Console Lo Shu Magic Square Creating Lo Shu Square Enter Nine Numbers (1-9) Number 1: 1 Number 2: 2 Number 3: 2 Error ... 2 is already in the Lo Shu Square. Try again Number 3: 3 Number 4: 4 Number 5: 5 Number 6: 10 Error ... Invalid number. Try again Number 6: 6 Number 7: 7 Number 8: 8 Number 9: 9 || 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | Sorry ... this is not a Lo Shu Magic Square Would you like to try again (y/n)? n
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning