Can anyone help me write a program that will print a sentence using 5 different words that are in 6 different array's based on a random number generated by the computer. Right now my code will print 5 sentences using each elimate from each array, but it doesn't pick the words at random from each array. Here is what I have so far:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
const char *a[5] = {"The", "A", "One", "Some", "Any"};
const char *n[5] = {"boy", "girl", "dog", "town", "car"};
const char *v[5] = {"drove", "jumped", "ran", "walked", "skipped"};
const char *p[5] = {"to", "from", "over", "under", "on"};
const char *a2[5] = {"the", "a", "one", "some", "any"};
const char *n2[5] = {"boy", "girl", "dog", "town", "car"};
char sent[35] = {0};
int num = rand();
int i = 0;
srand(time(NULL));
for( i = 0; i <= 4; i++){
num = 1 + rand() % 5;
sent[num];
printf("\nThe random number is %d.", num);
printf("\n\n%s %s %s %s %s %s.\n\n", a[i], n[i], v[i], p[i], a2[i], n2[i]);
}
return 0;
}