Shit in C
1
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?
41
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
42
Name:
Anonymous
2011-12-30 20:44
>>40
eat shit and die, lisp-advocating scumbag
43
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
44
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]);
45
Name:
Anonymous
2011-12-31 2:46
Lol u all a bunch of dumb niggers posting in a 2 year old thread
46
Name:
Anonymous
2011-12-31 2:57
>>44 '
starting at 1
printing a char with printf
using %s on a char
IHBT
47
Name:
Anonymous
2011-12-31 4:41
48
Name:
Anonymous
2011-12-31 4:43
49
Name:
Anonymous
2011-12-31 4:51
1 Name: Anonymous : 2009-02-25 10:09
50
Name:
Anonymous
2011-12-31 4:52
>>49
Yes we know, what is your point?
51
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 ^^
52
Name:
Anonymous
2011-12-31 5:28
>>51
printf("%s \n", &Word[2]);
prints
uccess (\n)
53
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....
54
Name:
Anonymous
2011-12-31 6:27
55
Name:
DUBS LIBERATION FRONT
2012-03-24 18:32
NON-DUBS SHALL BE CLEANSED FROM THE EARTH!
56
Name:
Anonymous
2012-03-25 9:40
Newer Posts