Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-23-2008, 10:44 PM   #11
88
Fully Optimized
 
88's Avatar
 
Join Date: May 2005
Posts: 4,775
Send a message via MSN to 88
Default Re: random(), randomize()

Quote:
Originally Posted by celegorm View Post
the command srand(Time.NULL) takes place of randomize.

oh, and joga, I've always seen it used as time.h not ctime.h maybe changing time.h (if that's what he's using) to ctime will fix it.
i thought <time.h> was for C and <ctime> was for C++?
__________________

__________________
Killing under the cloak of war is no different than murder

Kein Alkohol ist auch keine Lsung!
88 is offline   Reply With Quote
Old 04-23-2008, 11:34 PM   #12
Site Team
 
celegorm's Avatar
 
Join Date: Sep 2006
Posts: 10,713
Send a message via AIM to celegorm
Default Re: random(), randomize()

Quote:
Originally Posted by 88 View Post
i thought <time.h> was for C and <ctime> was for C++?
Idk... in my C++ class now it's time.h in C++, and it's still like that in MS's visual xpress '08.
__________________

__________________
"as a fanboy i refuse to admit it and will pull countless things out of my butt to disprove it"

Team Thelegorm! Total Kills: 21 (i iz in uor profile, editsing your sigz)
celegorm is offline   Reply With Quote
Old 04-24-2008, 12:42 AM   #13
Baseband Member
 
Join Date: Jun 2006
Posts: 22
Default Re: random(), randomize()

Quote:
Originally Posted by JogaBonito1502 View Post
No problem man. I never use random conversions. I had to for my semester final. So I just made a number guessing game which was really boring. If you want to see the code for that I can send you the file.
Oh no thank you. I am actually very good with Programming (100% on the first 5 chapters of C++ programming in my class in 3rd quarter). It's just converting from C++ 6.0 to Visual 2008 Requires outside knowledge.

I appreciate your help, and maybe over the summer I will keep excessively asking questions since I want to finish this book. Really since the built in types of statements are the same for all C++, only ones that calls from libraries i'll have trouble with. But thanks everybody!
shoover is offline   Reply With Quote
Old 04-24-2008, 05:51 PM   #14
Guru
 
JogaBonito1502's Avatar
 
Join Date: Jan 2008
Location: U.S.
Posts: 7,841
Default Re: random(), randomize()

Dude I love C++. Right now we're on Chapter 11 out of 16 in a year course. The class usually closes at 10 but we move to fast. Specially me. I decided to skip a couple and multitask chapter 11 and 15 as I want to learn something about saving into files. I'm looking for an idea for a project. Has to be decent sized. If you got one hit me up.
JogaBonito1502 is offline   Reply With Quote
Old 06-17-2008, 06:30 PM   #15
Beta Member
 
Join Date: Jun 2008
Posts: 4
Default Re: random(), randomize()

Quote:
Originally Posted by 88 View Post
i thought <time.h> was for C and <ctime> was for C++?
When I took C++, the Standard Template Library was introduced in the middle of our semester. Before that we used stdlib.h for the rand and srand fuctions and time.h for the time. However, once we started using the STL, we had to change to cstdlib and ctime because of compatibility issues with the other files. If we didn't... hundreds of errors.

-civis
civis is offline   Reply With Quote
Old 07-06-2008, 05:19 AM   #16
Beta Member
 
Join Date: Jul 2008
Posts: 1
Default Re: random(), randomize()

Hi
I agree with the solution given by celegorm
Try this and it will definitely work
__________________

deep32 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 08:42 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0