thyownage Posted November 30, 2009 Author Share Posted November 30, 2009 Well heres the programs I have to make… It would be great if someone new how to make these and could give me the code, thx.1\. Write a program to perform the following tasks:a. Ask the user for the dimensions of a 2D array.b. Declare a 2D array of the appropriate size.c. Read in values for all of the elementsd. Add up the diagonals of the arraye. Print the sum of the diagonalsf. Print the array2\. Write a program that generates magic squares. From Wikipedia: “In recreational mathematics, a magicsquare of order n is an arrangement of n2 numbers, usually distinct integers, in a square, such that the nnumbers in all rows, all columns, and both diagonals sum to the same constant.[1] A normal magicsquare contains the integers from 1 to n2\. The term "magic square" is also sometimes used to refer to anyof various types of word square.â€ÂTo create an n x n magic square, where n is odd, follow the following algorithm:a. place the value of 1 at row 0 and column n/2 + 1b. The next value goes 1 row up and 1 row to the rightc. If there is difficulty in placing the new element, follow these rulesi. If the new row is –1, place the value in the last rowii. if the column is n, then place the value in column 0iii. if the element is [0, n-1] then drop down one rowiv. if the position is already occupied, drop down one rowd. Repeat n * n timesExample of 5 * 517 24 1 8 1523 5 7 14 164 6 13 20 2210 12 19 21 311 18 25 2 9Input for program: nOutput: n x n magic square Link to comment Share on other sites More sharing options...
Drummerpete Posted November 30, 2009 Share Posted November 30, 2009 No one should do your homework for you. Link to comment Share on other sites More sharing options...
Gwen Posted December 1, 2009 Share Posted December 1, 2009 first one is pretty easy… but i dont have C# installed anymore so I am of no use to you :p Link to comment Share on other sites More sharing options...
Fruitpunch Posted December 1, 2009 Share Posted December 1, 2009 if you cannot make this yourself then you fail, end of story, this thread should be locked Link to comment Share on other sites More sharing options...
Marsh Posted December 1, 2009 Share Posted December 1, 2009 @thyownage:> Well heres the programs I have to make…Indeed you do Link to comment Share on other sites More sharing options...
thyownage Posted December 1, 2009 Author Share Posted December 1, 2009 …yea, umm I don't really do C#.... we were supposed to do something else in my class but they kind of randomly changed it on us :(, now no one nos what there doing lol.... and yes I know I fail... it's kinda sad :( Link to comment Share on other sites More sharing options...
Flaw Posted December 2, 2009 Share Posted December 2, 2009 @[SB:> Fruitpunch link=topic=54842.msg580636#msg580636 date=1259631282]> if you cannot make this yourself then you fail, end of story, this thread should be lockedThat's not very nice.. I definitely can't write these, does that mean that I "fail" too?thyownage: You have everything that you need defined already in your topic, putting it all together should be a simple matter of looking up the strings and variables and piecing them together no? Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2009 Share Posted December 3, 2009 This again? Seriously, I'm happy helping you out with anything your confused with… but I'm not writing the whole thing for you again (one time thing). If you tried it yourself and wanted opinions/help that would be different... but you cant just post up your homework and have the world solve your problems. Link to comment Share on other sites More sharing options...
thyownage Posted December 4, 2009 Author Share Posted December 4, 2009 haha ok thx lol, i'll post my questions later then :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now