Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / MAGIC SQUARE for DBClassic

Author
Message
gearce
17
Years of Service
User Offline
Joined: 18th Dec 2006
Location: ex SCOTLAND, now MELBOURNE, Australia
Posted: 3rd Feb 2007 02:51
Hello! My name is NOT Merlin and this is NOT a puzzle from a Wide and Wonderful World of Mystical Magic series, but still a bit of magic none the less in what is commonly known as a Magic Square, in which the sum of the numbers running horizontally, vertically or diagonally is always the same.

Each time it is run, Magic Square will create one of these squares from size 3x3 to size 9x9 with a starting number from 1 to 19. I have restricted the starting number to a high of 19 simply for screen appearance and to keep the numbers inside a size 9x9 square from exceeding two digits.



To have Magic Square create a square to your choice of size and starting number, simply go to this part of the programme and change size#=rnd(8)+1 and startnumber=rnd(18)+1.



Highlight the code, right click, copy and paste into DBClassic

Enjoy

gearce

LANG MAY YER LUM REEK
dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 9th Feb 2007 03:29
Heh, i did this in my C++ programming AP class.

<<<<<Used to be "djblackdragon" with being registered in January, 2003, no matter what it says on the left<<<<<

Login to post a reply

Server time is: 2024-11-23 00:14:28
Your offset time is: 2024-11-23 00:14:28