I don't know what am I doing wrong to that char since it's just a test program. I called srand() correctly just once, yet I don't know what is wrong with randchar, it still prints the same character.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
char randchar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" [rand() % 26];
int ve;
srand(time(NULL));
for(ve = 0; ve < 10; ++ve)
{
putchar(randchar);
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire