![]() |
|
#1
|
|||
|
|||
Assigning random valuesi am going to make domino game in c. The first step is to assigning random values from pre assigned array to two different arrays and compare them, so that no member of both arrays are identical...the code is given below which is not working properly and i want to use any other way to assign random numbers then random() function....
CPP / C++ / C Code:
Last edited by dsmith : 21-Jun-2004 at 08:47.
Reason: Please use [c] & [/c] for syntax highlightin
|
|||
|
#2
|
||||
|
||||
|
Hi enggwaqas.
What do you mean that the code isn't working? Is it crashing the computer or just not giving the results that you expected? Also, what compiler/OS are you using? The function random is not standard, you should use rand instead. Also, I have never seen the randomize function before so I don't think it is standard either. Look into using srand and rand instead. Anyway, if you can give us some more info, perhaps we can take a look at this. Cheers, d |
|
#3
|
|||
|
|||
|
the code that i was supplied in my previous post was not giving result properly i.e. it was assigning mutiple values to different cards..but now i have fixed this error by chaning the code completely and using nested structures array, instead of simple array.
Quote:
Im using Turbo C++ 4.5 / Borland C++ 5.0.... I have used random(int ) which is defined in stdlib header file to generate random numbers within specified limit, 0-28 in this program, instead of rand() which generate random numbers within RAND_MAX limit & randomize() is used before both random and rand to randomize on every run. I have completed the shuffling part of my program. Now next step will be displaying graphical cards...when user press right/left button then approproate card will be highlited...some ideas are required from you |
|
#4
|
||||
|
||||
|
I'm assuming then that your initial question has been solved. I can't help you with the graphics, but there may be someone else here that can... if your first problem hasn't been solved, I can help with that.
__________________
-Aaron |
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| store values | skyloon | MySQL / PHP Forum | 6 | 23-Jul-2005 04:29 |
| Need a script for selecting random tabels and from those tabels selecting random ques | mlt | MySQL / PHP Forum | 2 | 12-Sep-2003 10:01 |
| getting values | zuzupus | MySQL / PHP Forum | 2 | 07-Aug-2003 05:33 |
| Random no longer JUST random... | JdS | GIDTopsites™ | 0 | 12-Jan-2003 09:57 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The