473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Magic Squares

I want to Develop an algorithm and computer program to find a solution to the following puzzle:
A grid 4 x 4:
Using only numbers from 1 to 16 and i have to fill the number such that no number can be used twice
• The sum of each row is 34
• The sum of each column is 34

Several solutions are possible, but each is a rotation or mirror image of another.
A solution to the equivalent 3 x 3 puzzle is shown below:

4 9 2
3 5 7
8 1 6
I know either i have to-
Use a random number generator to obtain numbers between 1 and 15.
Use modular decomposition to separate the calculation tasks into functions.
Use #define to create constants such as SIZE and ROWTOTAL.
The grid should be a 2 dimensional array which is passed by reference into functions.
so can anyone one plz help me or provide me idea to create the program thanks
Aug 29 '07 #1
2 2831
JosAH
11,448 Expert 8TB
I want to Develop an algorithm and computer program to find a solution to the following puzzle:
A grid 4 x 4:
Using only numbers from 1 to 16 and i have to fill the number such that no number can be used twice
• The sum of each row is 34
• The sum of each column is 34

Several solutions are possible, but each is a rotation or mirror image of another.
A solution to the equivalent 3 x 3 puzzle is shown below:

4 9 2
3 5 7
8 1 6
I know either i have to-
Use a random number generator to obtain numbers between 1 and 15.
Use modular decomposition to separate the calculation tasks into functions.
Use #define to create constants such as SIZE and ROWTOTAL.
The grid should be a 2 dimensional array which is passed by reference into functions.
so can anyone one plz help me or provide me idea to create the program thanks
Greetings, you've posted your question in the wrong section; it belongs in the
C/C++ Forum section, not the C/C++ Articles section. I'll move your question
over to the Forum for you

kind regards,

Jos
Aug 29 '07 #2
Ganon11
3,652 Expert 2GB
Please use a clearer title in the future; a title such as "Help Me!" does nothing to give experts an idea of your problem, and many will simply skip the topic. With a clear title indicating the problem, many experts will stop to see if they can help you or not.

Also, please do not double-post your question.

Thanks!
Aug 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: binger | last post by:
Okay, Superbowl is only a few days away, but I thought it would be cool to set up an online registration for a football squares pool. My thoughts are to have people go into anywhere on the 10x10...
1
by: shaveta | last post by:
pls guide me to write a program in c to generate a magic square of size n*n , where n is odd A magic square is an n*n matrix of integer from 1 to n^2, where n is odd, such that the sum of every...
10
by: wazzup | last post by:
C++ is new to me and I'm trying solve this problem but get stuck. Please help me out. Below is the task and after that is what i got so far. Create a program to print nested squares Input:...
8
evilmonkey
by: evilmonkey | last post by:
I am using swing to nest squares with in squares (256 times) and that part is working fine, but what i want to do is change the color of each line so that the red green and blue components each...
4
by: jyck91 | last post by:
can any one tell me?? what should i do before i strating wirtitng the magic square programe
1
by: magic man | last post by:
I am 50 years old ...and am working physical models of the math structure called a magic square .. for my own interest. My present problem is this. I have a topograhical model for the square...
1
by: jyohere | last post by:
I have a problem to solve.I want to draw squares and lines connecting them.The number of squares is only known at runtime.How can it be done.if someone has some code like this,pls help.I am able to...
1
by: J.SanTanA | last post by:
Hello All! Any one know where can I find some php code (or "php-able" code) implementing least squares method? Thx in advance and pls excuse my poor eng
4
by: Evelien | last post by:
Dear python-users, I am trying to do a non-linear least squares fitting. Maybe trying is not the best word, as I already succeeded in that. At the moment I am using leastSquaresFit from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.