im writing a simple lotto simulator, not finished, but i when drawing the numbers they are all the same unless a lot of time goes by
Im using srand() like this
srand(time(NULL));
...
Type: Posts; User: ~C_Student~
im writing a simple lotto simulator, not finished, but i when drawing the numbers they are all the same unless a lot of time goes by
Im using srand() like this
srand(time(NULL));
...
I was wondering if someone could explain whats happening here, im supposed to make my own functions for iv_new, iv_push and iv_get, but i don't understand the structures that are given
...
thanks, it is now compiling, and generating a num, but its the same number everytime
I keep getting this error when trying to compile
int gen_rand(void) {
int n;
n = random(100); /* n is random number in range of 0 - 99 */
return(n);
}
because \n is an escape key
i think my ps_set is wrong because i just added a printf statement to tell me the length
and "hello " = 6
and "world\n" = 6
but world is only supposed to be 5 :S
well my output is
1 0 -1
helloworlo
supposed to be
i have got it almost working, my output is just a bit weird, im gonna stop posting my code in case other students in my class start using my code as well, most of the code from my previous posts has...
but im passing it an array that contains chars...
int i;
for (i = 1; i < dest[0]; i++) { //dest[0] has the length of the array in this spot
printf("%s", dest[i]); //error is...
what does this error mean, i been messing with it but can't make it go away
new.c: In function ‘ps_put’:
new.c:87: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
Thanks for explaining that it totally makes sense now, im gonna go see if i can code it now
So if im putting two strings together lets say:
a = "world"
b = "hello "
in my program it is called like this
ps_cat(b,a);
Ok so i think i got the ps_set function done, hows it look
void ps_set(pstring dest, const char *test){
int i, b, len;
for (i = 1; i != '\n' && b <= PSTRING_MAX; i++) {
dest[i] =...
ok so i just worked this out on paper.
example: " ps_set(a,"hello") "
would put the word "hello" in an array starting at a[1]
void ps_set (pstring dest, const char string){
int i = 1,...
Yes i am getting over whelmed by the entire program.
I have been looking everywhere about this, and people are saying that it would be pointless to rewrite the functions because they are about...
Hello im an 2nd year university student, and i am stuck on an assignment.
I am supposed to store the length of the string in the zero'th element of the array, and the remaining characters after....