I need to do HW assignment that creates a sentence. I need to use random generation. I understand it using numbers but I am clueless when it comes to something like this. Here's my portion of code I have so far:
Code:
/* Joseph Duke fig 8.11 p4.c
Using random generation to create sentence */
#include<stdlib.h>
#include<stdio.h>
#include <string.h>
#include <time.h>
#define SIZE 5
int main()
{
char *article[5][20] = {"the", "a", "one", "some", "any"};
char *noun[5][20] = {"boy", "girl", "dog", "town", "car"};
char *verb[5][20] = {"drove", "jumped", "ran", "walked", "skipped"};
char *prep[5][20] = {"to", "from", "over", "under", "on"};
char *sentence[] = {0}; /* sentence the words form */
char *word;
int i; /* for loop variable */
srand(time(NULL));
for (i=0; i < SIZE; i++)
{
/* joins and prints the sentence */
article = rand();
I know I am way off base here but I don't know how to use rand() function in this case. Can any one give me any hints? Thanks