Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Shit in C

Name: Anonymous 2009-02-25 10:09

I'm trying to set the contents of a string based on what random number is generated by my srand.

dice = rand() % 10 + 1;

if ( dice = 1 )
word[20] = "Success";

^-- this shit doesn't work, though.

tl;dr. I want my "dice rolls" to generate a random number, random number corresponds to a pre-set word, and the preset word to be printed.

I'm probably going about it the wrong way. Suggestions from experts?

Name: Anonymous 2011-12-30 19:37

34>>

Nested-trie dictionary implementation, with the capacity to slurp up new words from random text files passed via cmdline...

I was just feeding it random webpages so it could learn lots of words cheaply

...Crazy trying to hard-code words you want to use

Name: Anonymous 2011-12-30 20:44

>>40
eat shit and die, lisp-advocating scumbag

Name: Anonymous 2011-12-30 20:51

Probably a bad example for someone who is new to coding though..

In turbo pascal (or most any language =D) you could just use a readline / writeline to store & load words from a text file... then just pick words (/lines from the file) at random, and print to screen...

might only need 20-30 lines of turbo to get it to work

Name: Anonymous 2011-12-30 23:10

...back to basics


Word[1]='S';
Word[2]='u';
Word[3]='c';
Word[4]='c';
Word[5]='e';
Word[6]='s';
Word[7]='s';
Word[8]=(char) 0;

printf("%s \n", &Word[1]);

Name: Anonymous 2011-12-31 2:46

Lol u all a bunch of dumb niggers posting in a 2 year old thread

Name: Anonymous 2011-12-31 2:57

>>44'
starting at 1
printing a char with printf
using %s on a char


IHBT

Name: Anonymous 2011-12-31 4:41

>>46
You're a moron.

Name: Anonymous 2011-12-31 4:43

>>47
%p

Name: Anonymous 2011-12-31 4:51


1 Name: Anonymous : 2009-02-25 10:09

Name: Anonymous 2011-12-31 4:52

>>49
Yes we know, what is your point?

Name: Anonymous 2011-12-31 5:15

...back to (even more) basic's

Word[2]='S';
Word[3]='u';
Word[4]='c';
Word[5]='c';
Word[6]='e';
Word[7]='s';
Word[8]='s';
Word[9]=(char) 0;

printf("%s \n", &Word[2]);


...And it still prints "Success (\n)"...

...poor anon had to wait 3 whole yrs ^^

Name: Anonymous 2011-12-31 5:28

>>51

printf("%s \n", &Word[2]);

prints
uccess (\n)

Name: Anonymous 2011-12-31 5:54

>>52

did you re-copy the whole code, or just the printf?

(Notice it now starts at 2 for both [Word[2]='S';] & [printf("%s \n", &Word[2]);])

=( this isn't really making up for being stuck at home on new years....

Name: Anonymous 2011-12-31 6:27

>>53
Oh ic, i derped.

Name: DUBS LIBERATION FRONT 2012-03-24 18:32

NON-DUBS SHALL BE CLEANSED FROM THE EARTH!

Name: Anonymous 2012-03-25 9:40

>>48
You're a moron.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List