![]() |
|
#1
|
|||
|
|||
Need Help URGENTin the attachment is the main code
need to get a random number form initcells.h just let me post it CPP / C++ / C Code:
CPP / C++ / C Code:
if the number i put in is 12 then output should be like this Gen 1 . # .++.++ ##+##.+. #.. .## + ++ #. + # . ++#+++ +.+ . #.### Gen 2 .... .++++++ ####+++. ....# + ++ ..+ ...+####+ +++... .# Gen 3 ..++..++####+ ###++..++. + ++ ..++ ...++## ## +#+++... . Gen 4 +++++++## ## ... ##++++++.. + ++..+++..+++## ####+++.... Gen 5 +####### ..+... ######++..+ +++++#++++### .... ###+++++ Gen 6 ## .....++++.. ##++++ +########## ..++.... ###### Gen 7 .......+++++##++...... ####+ ## ...++++++... Gen 8 ....+++++++#######++++++.. ## ..........+++####+++........ Gen 9 +++++####### ######++.... ....++++++++++### ###+++++++++ Gen 10 ###### ... ##++++......++++########## ########## Gen 11 .......+...... ####++++++++#### .... Gen 12 ........++++++++++++.. ########## ..........++............ Gen 13 +++++++++##########++.... ....+++++++++++++++++++++++ Gen 14 ########## ##++++..............++++###################### Gen 15 ...... ####++++++++++++++++#### Gen 16 ............++++.. ################## .................... Gen 17 +++++++++++++##++.... ....+++++++++++++++++++ Gen 18 ################++++......................++++#### ############## Gen 19 ####++++++++++++++++++++++++#### Gen 20 .............. ########################## ................ but it came out like this Gen 1 . # .++.++ ##+##.+. #.. .## + ++ #. + # . ++#+++ +.+ . #.### Gen 2 #### ### ################### ### # # ## #### Gen 3 #### .# .# ################## ############ Gen 4 ################## ############################################ Gen 5 ################################################## ############## Gen 6 Segmentation Fault (core dumped) i reallly need this coz it due on this friday thx |
|||
|
#2
|
|||
|
|||
|
Quote:
A few points: First of all: did you notice that the first row has correct values? (Look again, in case you missed it.) Second: How many rows are in the cells array? Third: How many rows are filled in by the function initCells()? Fourth: How many rows are printed out by the function printNum()? Regards, Dave A PostScript: Where did you get the stuff that you say "should be like this". If that's what the generator actually gives, then I would say it is an extremely poor function. I would never expect the long run shown on the later rows from a uniform variate. If you (or someone) is really interested, maybe someone can do some analysis to see what's the probability that the given samples came from a uniformly distributed random variable. I'll bet it's realllllly small. On the other hand, I would expect the given algorithm to perform much better. Just thought I would mention it. D Last edited by davekw7x : 19-Apr-2005 at 14:04.
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Communication via the rs232 interface | banur22 | C++ Forum | 1 | 13-Apr-2005 12:04 |
| Urgent Problem with Checkboxes inside a Tree Control on MSVC 6 | yonoid | MS Visual C++ / MFC Forum | 0 | 10-Mar-2005 12:46 |
| urgent help needed :c + mysql insert | jack | C Programming Language | 1 | 13-Apr-2004 22:16 |
| urgent help:string concat | jack | C Programming Language | 3 | 11-Apr-2004 10:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The