so I'm creating a program that generates random sentences with structs but i need some help... I'm trying to use structs and and create 4 different groupings article, noun, verb, and preposition. Then I'm trying to use "r = rand() % ;" to randomly pick one one word from each group to make a sentence.
this is what i have
Code:
typedef enum article
{
the = 1, a, one, some, any
} article;
typedef enum noun
{
boy = 1, girl, dog, town, car
} noun;
typedef enum verb
{
drove = 1, jumped, ran, walked, skipped
} verb;
typedef enum preprositions
{
to = 1, from, over, on
} preprositions;
typedef enum noun
{
boy = 1, girl, dog, town, car
} noun;
Did I do that part correctly? is there a better way?
then something like this?....
Code:
for (i =0, i <20, i++)// i want to generate 20 random sentences
{
r= rand () % 5
printf ("%c", r->article);
r= rand () % 5
printf("%c", r->noun);
........
}
what do i do next? what did i miss?