Skip to main content
0 online
orbitz May 30, 2003

Just a note: the * does not really go with the datatype, but it does define its type. For instance: int *p, q; is the same as int *p; int q; to make 2 pointers it would be: int *p, *q; A...

ok4now ok4nowOG 2002

thanks for the suggestions. here are some responses:

i know that int *p, q; is the same as int *p; int q;

i guess i'm not seeing it all just yet, because i don't fully understand why the prototype is "function(int *);" i'm doing it now cuz it works.


i'm trying to get away from the .h files. but my compiler didn't have them without the .h. do u think i can manually rename the files? do i have to install additional libraries? for time's sake, i just added the .h so the compiler stopped complaining. (btw, i'm using Visual Studio 6.0)


i know u said 'int main()' before. right now, the professor wants it this way. we're not returning a code to the OS, so it really doesn't matter right now. (does it?)


i know void functions don't need return. i don't think i was consistent, but i wanted the empty returns to be clear that no value was returned. i was told it's optional.


it's a funny thing u said about the function names. just today, i learned about the 'get' method for i/o. now i see a confusion with 'getseed'. before today, i just read it as 'go get a seed value' and 'go get a random number'. they'll get changed now.


i actually referenced the wrong page in my book for the random function. the return code i ended up using was:

return (int)((high - low) * random + low);

u said 'you're not sure exactly what this is supposed to do...', but then you explain it anyway. so i'm figuring you get it.

  • RAND_MAX, of course, is the highest random integer (usually 32,728 or something).

  • (double)(RAND_MAX) type casts the integer to a double

  • rand()/((double)(RAND_MAX)+1); gives a small number (like 0.6523829)

  • return (int)((high - low) * random + low); should type cast the double into an integer. and this is supposed to be inclusive, but i couldn't prove it. choosing a range of 1 and 3, the answer was always 2 (after 10 tries...i'm not gonna keep running the program at 3am!)


anyway...everything's turned in, and i'm onto the next assignment. now we're doing file i/o with a high score file, creating an encrypted file and decrypting a file....oh goodie!

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.

💎

Gems

Spot something you love — a legendary comment, a classic thread, a great photo? Log in and click the diamond icon to mark it as a Gem. Add a note about why it's special. The best stuff surfaces on the Gems page.