my program prints out characters that dont even exist, actually the program should try to guess the given word, here is my program
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
int main(){
int index, i;
time_t t;
char characters[] = "bdefgir";
char word[] = "friedberg";
srand((unsigned)time(&t));
char result[9] = {0};
while(strcmp(result, wort) != 0){
for (i = 0; i < 9; i++) {
index = rand() % 8;
result[i] = characters[index];
}
printf("Result:\t%s\n", result);
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire