| | |
help in c++
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
According to Cplusplus.com, rand() returns a pseudo-random integral number in the range 0 to RAND_MAX. This number is generated by an algorithm that returns a sequence of apparently non-related numbers each time it is called. This algorithm uses a seed to generate the series, which should be initialized to some distinctive value using srand.
And that's all you need to know about that.
Now for this:
If you hadn't waited for the last minute to start your homework, it wouldn't be urgent now would it?
Now next time you post:
- use code tags
- Create a meaningful title
- Ask a clear question
- Don't use words like 'urgent'
And that's all you need to know about that.
Now for this:
If you hadn't waited for the last minute to start your homework, it wouldn't be urgent now would it?
Now next time you post:
- use code tags
- Create a meaningful title
- Ask a clear question
- Don't use words like 'urgent'
•
•
Join Date: Nov 2008
Posts: 9
Reputation:
Solved Threads: 0
hello. thanxs.
can u pls conform this equation : any no from 0 to 9 are used and after module and add 1 store in x[i]. pls reply.
can u pls conform this equation : any no from 0 to 9 are used and after module and add 1 store in x[i]. pls reply.
•
•
•
•
According to Cplusplus.com, rand() returns a pseudo-random integral number in the range 0 to RAND_MAX. This number is generated by an algorithm that returns a sequence of apparently non-related numbers each time it is called. This algorithm uses a seed to generate the series, which should be initialized to some distinctive value using srand.
And that's all you need to know about that.
Now for this:
If you hadn't waited for the last minute to start your homework, it wouldn't be urgent now would it?
Now next time you post:
- use code tags
- Create a meaningful title
- Ask a clear question
- Don't use words like 'urgent'
•
•
•
•
hello. thanxs.
can u pls conform this equation : any no from 0 to 9 are used and after module and add 1 store in x[i]. pls reply.
How to use rand()
•
•
•
•
hello. thanxs.
can u pls conform this equation : any no from 0 to 9 are used and after module and add 1 store in x[i]. pls reply.
What do you want? Do you want a random number between 0-9 or 1-10? How big is your x[] array? Where do you seed the random generator with
srand()? Last edited by niek_e; Nov 14th, 2008 at 5:20 am.
•
•
Join Date: Nov 2008
Posts: 9
Reputation:
Solved Threads: 0
sorry for the disturb you. but i m big problem.
i make a sudoku game and for that i use this conditon to generate a random no bet o to 9.
i want to conform it takes a value by following code. i m new in programming. and donot know how to do this game. and i have only 4 days to complete it..
i make a sudoku game and for that i use this conditon to generate a random no bet o to 9.
i want to conform it takes a value by following code. i m new in programming. and donot know how to do this game. and i have only 4 days to complete it..
•
•
•
•
sorry for the disturb you. but i m big problem.
i make a sudoku game and for that i use this conditon to generate a random no bet o to 9.
C++ Syntax (Toggle Plain Text)
// Seed the generator. Do this ONLY ONCE srand((unsigned)time(NULL)); cout << (rand() % 9) +1;
•
•
•
•
i m new in programming. and donot know how to do this game. and i have only 4 days to complete it..
But I guess that this isn't your first assignment right? And you probably got more then 4 days to finish it, true?
So, again: If you started earlier, you wouldn't have a problem now.
•
•
Join Date: Nov 2008
Posts: 9
Reputation:
Solved Threads: 0
thank u niek for the help. i started this game 3 days ago, but to develop a logic my time is spent. i m not complain to u. and i m not a student i m a flash developer. i m new in development. this is my first task, and that's why i want to do my best to complete it. b'coz first impression is last imperssion.
•
•
•
•
All the sudoku's I've ever played had numbers from 1-9 and not 0-9, but whatever. Here's a small example that gives 1 random number in the range 1-9:
C++ Syntax (Toggle Plain Text)
// Seed the generator. Do this ONLY ONCE srand((unsigned)time(NULL)); cout << (rand() % 9) +1;
If you're new in programming and this is your first assignment and you only got 4 days to finish it, you should complain to your teacher, not me.
But I guess that this isn't your first assignment right? And you probably got more then 4 days to finish it, true?
So, again: If you started earlier, you wouldn't have a problem now.
![]() |
Other Threads in the C++ Forum
- Previous Thread: new to c++ __coverting uppercase to lowercase vice versa
- Next Thread: How to set a random no function for positions of a box in FLTK?
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






