Home Forums Gamescan Chat42 About
* Login   * Register * FAQ    * Search
It is currently Fri 01-30-2026 2:18PM

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: CS53 homework
PostPosted: Sat 10-09-2004 9:27PM 
Offline
Major
User avatar

Joined: Sat 08-21-2004 4:49PM
Posts: 427

Source: Farrar Hall
I missed a class on Wednesday and am having some problems figuring out the next assignment, if someone could IM me at GeraldC69 on aim so I could get some things clarified that would be awesome.

_________________
"Suche gut gebauten Achtzehn- bis Dreißigjährigen zum Schlachten"
Der Metzgermeister

\\GMAN 160GB+ shared


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Sat 10-09-2004 11:00PM 
Offline
Major General
User avatar

Joined: Mon 09-01-2003 6:23PM
Posts: 2880
Location: Either at the source below, or in 859 TJ south

Source: TJ South
If you could post some of what you know you have to do, people on here would be able to help.

_________________
The nicest asshole you probably wish you had never met.

Remember, Jesus loves you...but he doesn't put out.


Top
 Profile  
    
 Post subject:
PostPosted: Sun 10-10-2004 2:27PM 
Offline
Captain

Joined: Tue 11-18-2003 11:56PM
Posts: 169

Source: Christian Campus House
it would also help if we knew who you had for a prof.


Top
 Profile  
    
 Post subject:
PostPosted: Sun 10-10-2004 3:11PM 
Offline
Major
User avatar

Joined: Sat 08-21-2004 4:49PM
Posts: 427

Source: Farrar Hall
I'm still a little confused on the functions a little bit, mostly the definitions I believe. Prof is Price.

_________________
"Suche gut gebauten Achtzehn- bis Dreißigjährigen zum Schlachten"
Der Metzgermeister

\\GMAN 160GB+ shared


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Sun 10-10-2004 10:56PM 
Offline
Major
User avatar

Joined: Sat 08-21-2004 4:49PM
Posts: 427

Source: Farrar Hall
The day I was gone was the day he talked about random # generators, and I don't know how to set a min and max perameter on it in a function.

could someone help a noob out?

_________________
"Suche gut gebauten Achtzehn- bis Dreißigjährigen zum Schlachten"
Der Metzgermeister

\\GMAN 160GB+ shared


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Mon 10-11-2004 1:47AM 
Offline
Lieutenant
User avatar

Joined: Tue 08-19-2003 11:48PM
Posts: 95
Location: A country within a closet.

Source: TJ North
I'm in Sea's class, so this may not be what Price wants, but it should work.

First you need to seed the function. We're using the system time to do so. The statement is "srand(time(NULL));" You'll need to include the <ctime> library.

To generate actual numbers, call the function "rand(max)", where "max" is the integer set as the maximum parameter. For a minimum, you'll need to put the "rand" function in a do-while loop until it gives you a value greater than the minimum. The "rand" function is in the <cstdlib> library, so you need to include that, too.

And if all else fails, look in the textbook. Page 965, I think.

Hope that helps.

_________________
"Didn't the pirates take everything already?"
"They left everything that was nailed down. I did not."

–Black Mage and Thief, "8-bit Theater"


Top
 Profile  
    
 Post subject:
PostPosted: Mon 10-11-2004 2:04AM 
Offline
Major
User avatar

Joined: Sat 08-21-2004 4:49PM
Posts: 427

Source: Farrar Hall
lol, I've somewhat gotten past that, now I'm just kinda screwed on how I fit all these functions together correctly. Our program has to have 7 functions in it and It's really getting complicated the way I'm trying to do it, I've got to be doing it wrong somehow. I could do this no problem with the use of only 2 or 3 functions but linking 7 of them together seems to be really tough. I think it might be his dirrections that are throwing me off more then anything though, there is no way I'm going to finish this assignment and I've probably spent over 8 hours on it. lol, my grade is going to shit in that class :evil: .


eh, nevermind, went and got some help from the professor to clear a lot of things up :) .

_________________
"Suche gut gebauten Achtzehn- bis Dreißigjährigen zum Schlachten"
Der Metzgermeister

\\GMAN 160GB+ shared


Last edited by Dissension on Mon 10-11-2004 12:07PM, edited 1 time in total.

Top
 Profile E-mail  
    
 Post subject:
PostPosted: Mon 10-11-2004 8:19AM 
Offline
Gun Hater
User avatar

Joined: Fri 09-03-2004 1:27PM
Posts: 2748
Location: 752 TJ

Source: TJ South
Dissension wrote:
The day I was gone was the day he talked about random # generators,


you mean dice?

_________________
And the tongue is a flame of fire. It is full of wickedness that can ruin your whole life. It can turn the entire course of your life into a blazing flame of destruction, for it is set on fire by hell itself.


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Mon 10-11-2004 12:27PM 
Offline
Brigadier General

Joined: Tue 01-22-2002 12:35PM
Posts: 1057
Location: Shawnee Mission, KS

Source: Off Campus
Jrquinlisk wrote:
To generate actual numbers, call the function "rand(max)", where "max" is the integer set as the maximum parameter. For a minimum, you'll need to put the "rand" function in a do-while loop until it gives you a value greater than the minimum. The "rand" function is in the <cstdlib> library, so you need to include that, too.


Why not just call rand() and take the result and mod it with your maximum + 1 ?

In other words:

int result;
const int MaximumRandomNumber = 1000; //I made that up, use whatever you're supposed to.
result = rand() % (MaximumRandomNumber + 1);

EDIT: Derf, I'm a tard, that doesn't do what you need.

Scale the limits back to zero. Suppose you want a number between 200 and 800. So, set your maximum for the random generator to 600 (which is 800 minus 200). That'll generate a number between 0 and 600. Then add 200 to that result. The smallest number that rand() would generate is 0. 0 + 200 = 200, your lower limit. The largest number that rand(600) would generate is 600. 600 + 200 = 800, your upper limit.


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Mon 10-11-2004 12:42PM 
Offline
Major
User avatar

Joined: Sat 08-21-2004 4:49PM
Posts: 427

Source: Farrar Hall
Yeah, I get that now, makes a whole lot more sence :D

_________________
"Suche gut gebauten Achtzehn- bis Dreißigjährigen zum Schlachten"
Der Metzgermeister

\\GMAN 160GB+ shared


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 10-12-2004 1:31PM 
Offline
Major
User avatar

Joined: Sat 08-21-2004 4:49PM
Posts: 427

Source: Farrar Hall
NVM, problem resolved

_________________
"Suche gut gebauten Achtzehn- bis Dreißigjährigen zum Schlachten"
Der Metzgermeister

\\GMAN 160GB+ shared


Top
 Profile E-mail  
    
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group