Thread: how to arrange the 361 data in 19x19 box?

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    6
    Given data from 0-360, how to arrange the data like below using C#?

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    1 9 19 29 39 49 59 69 79 89 99 109 119 129 139 149 159 169 179 189
    2 198 207 216 225 234 243 252 261 270 279 288 297 306 315 324 333 342 351 360
    3 8 18 28 38 48 58 68 78 88 98 108 118 128 138 148 158 168 178 188
    4 197 206 215 224 233 242 251 260 269 278 287 296 305 314 323 332 341 350 359
    5 7 17 27 37 47 57 67 77 87 97 107 117 127 137 147 157 167 176 187
    6 196 205 214 223 231 241 250 259 268 277 286 295 304 313 322 331 340 349 358
    7 6 16 26 36 46 56 66 76 86 96 106 116 126 136 146 156 166 176 186
    8 195 204 213 222 231 240 249 258 267 276 285 294 303 312 321 330 339 348 357
    9 5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 165 175 185
    10 194 203 212 221 230 239 248 257 266 275 284 293 302 311 320 329 338 347 356
    11 4 14 24 34 44 54 64 74 84 94 104 114 124 134 144 154 164 174 184
    12 193 202 211 220 229 238 247 256 265 274 283 292 301 310 319 328 337 346 355
    13 3 13 23 33 43 53 63 73 83 93 103 113 123 133 143 153 163 173 183
    14 192 201 210 219 228 237 246 255 264 273 282 291 300 309 318 327 336 345 354
    15 2 12 22 32 42 52 62 72 82 92 102 112 122 132 142 152 162 172 182
    16 191 200 209 218 227 236 245 254 263 272 281 290 299 308 317 326 335 344 353
    17 1 11 21 31 41 51 61 71 81 91 101 111 121 131 141 151 161 171 181
    18 190 199 208 217 226 235 244 253 262 271 280 289 298 307 316 325 334 343 352
    19 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180
    Last edited by jimmyymmij; 01-02-2009 at 01:21 AM.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    What (specific) part are you having trouble with?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    An array

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    129
    A simple array, and a mathematical function will sort this.
    He who asks is a fool for five minutes, but he who does not ask remains a fool forever.

    The fool wonders, the wise man asks. - Benjamin Disraeli

    There are no foolish questions and no man becomes a fool until he has stopped asking questions. Charles Steinmetz

  5. #5
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Or a two dimensional array, and an even more simple math function.

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    6
    i cant get the formula to put in the array.

  7. #7
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I have a bad feeling of "do my homework".

    Anyone else?

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > i cant get the formula to put in the array.
    What formula?

    Like this perhaps, or something similar?
    http://en.wikipedia.org/wiki/Magic_square


    You can't just post "how do I get this answer" without some context for the question.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Registered User
    Join Date
    Jan 2009
    Posts
    6
    Quote Originally Posted by indigo0086 View Post
    I have a bad feeling of "do my homework".

    Anyone else?
    I am sorry for that. At first i really cant get it, so I need some expert to help. Finally i can get the answer already although it is a bit different from it. Anywhere thank your opinion and sorry for the caused of that bad feel.

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    6
    Quote Originally Posted by Salem View Post
    > i cant get the formula to put in the array.
    What formula?

    Like this perhaps, or something similar?
    http://en.wikipedia.org/wiki/Magic_square


    You can't just post "how do I get this answer" without some context for the question.
    thanks for the advice and thanks for ur help, i got the idea from the link u gave. Thank you so much.

  11. #11
    Registered User
    Join Date
    Jan 2009
    Posts
    6
    Thank everyone that give me opinion and i am sorry for the mistake that i may done cause i am still new with this. Sorry for the inconvenience that i made. Hope everyone can continue to give me idea if i got problem afterwards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  2. Combo Box in MFC, how to randomize data of it...please help!
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 06-24-2002, 02:26 AM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. list box in mfc, get data from file
    By davebaggott in forum Windows Programming
    Replies: 9
    Last Post: 10-08-2001, 04:45 PM