markiemrboo Posted July 10, 2005 Posted July 10, 2005 I find Dev-C++ is a good IDE, comes with gcc as its compiler. http://prdownloads.sourceforge.net/dev-cpp...9.9.2_setup.exe Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 10, 2005 Posted July 10, 2005 Actually, the Min-GW version of GCC(Minimal GNU for Windows GNU C Compiler, if you're wondering). EDIT: And how do you use that K&R Rand() function? Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 10, 2005 Posted July 10, 2005 Actually, the Min-GW version of GCC(Minimal GNU for Windows GNU C Compiler, if you're wondering).EDIT: And how do you use that K&R Rand() function? 506552[/snapback] (root|bone)/usr/local/etc/rc.d# man 3 randRAND(3) FreeBSD Library Functions Manual RAND(3) NAME rand, srand, rand_r -- bad random number generator LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <stdlib.h> void srand(unsigned seed); int rand(void); int rand_r(unsigned *ctx); DESCRIPTION These interfaces are obsoleted by random(3). The rand() function computes a sequence of pseudo-random integers in the range of 0 to RAND_MAX (as defined by the header file <stdlib.h>). The srand() function sets its argument seed as the seed for a new sequence of pseudo-random numbers to be returned by rand(). These sequences are repeatable by calling srand() with the same seed value. If no seed value is provided, the functions are automatically seeded with a value of 1. rand_r() provides the same functionality as rand(). A pointer to the context value ctx must be supplied by the caller. SEE ALSO random(3) STANDARDS The rand() and srand() functions conform to ISO/IEC 9899:1990 (``ISO C90''). The rand_r() function is as proposed in the POSIX.4a Draft #6 document. FreeBSD 4.11 May 25, 1999 FreeBSD 4.11 So.. srand(time(NULL)); rand() % 10; Would be random numbers between 0 and 9. If you wanted 1 to 10 then, (rand() % 10) + 1; Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 10, 2005 Posted July 10, 2005 Ah... I'll work on making sense of that when I'm not nine-eigthes asleep. Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 10, 2005 Posted July 10, 2005 Ah... I'll work on making sense of that when I'm not nine-eigthes asleep. 506631[/snapback] i've been being a code monkey all day, updating my sig. I hacked up (stole lots of code from) the lovely unix tool called `top` to make me a program which only outputs the total cpu usage, then hacked me up a C program which connects to mysql, takes the output of my hacked up cpu usage program via a pipe and finally sticks that number in the database.... then when my sig updates every hour it reads the cpu usage stuffs stored in the database and draws a graph Cept it's drawing backwards because mysql is poo and it wont lemme do my subselect. Much fun! Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 11, 2005 Posted July 11, 2005 Well, I just got a programming request... forcing a monitor to display 800x600 in the center with black fill-in around the picture. Time to practice my OpenGL. Share this post Link to post Share on other sites More sharing options...
Akujin Posted July 11, 2005 Posted July 11, 2005 If you guys need practice there's a game making compo going on over at http://compo.tomt64.com/. I'm competing in it Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 11, 2005 Posted July 11, 2005 Sure, I'll make a... Put in a number and see what memory address it's in game! EDIT: Do I win? /*Put-in-a-number-and-see-what-address-it's-in Game */ /** (c)Sam Tootell, Nebul-X **/ #include <stdio.h> #include <stdlib.h> int inputNumbar; int main(void) { printf("Enter a numbar!"); scanf(&inputNumbar); printf("%d is the address!\n\n\n", &inputNumbar); system("pause"); return 0; } Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 11, 2005 Posted July 11, 2005 Sure, I'll make a...Put in a number and see what memory address it's in game! 507253[/snapback] haha Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 11, 2005 Posted July 11, 2005 I think I lost: 12 C:\Dev-Cpp\numbargame.cpp cannot convert `int*' to `const char*' for argument `1' to `int scanf(const char*, ...)' Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 11, 2005 Posted July 11, 2005 lol. If you're actually being serious and trying to do that, you probably want to read it in to a char* and then convert whatever gets put in there to an integer with atoi() TOI(3) NAME atoi -- convert ASCII string to integer LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <stdlib.h> int atoi(const char *nptr); DESCRIPTION The atoi() function converts the initial portion of the string pointed to by nptr to integer representation. It is equivalent to: (int)strtol(nptr, (char **)NULL, 10); SEE ALSO atof(3), atol(3), strtod(3), strtol(3), strtoul(3) STANDARDS The atoi() function conforms to ISO/IEC 9899:1990 (``ISO C90''). FreeBSD 4.11 June 4, 1993 FreeBSD 4.11 Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 11, 2005 Posted July 11, 2005 So, in idiot speak, that means... Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now