g. 366*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
int main (void)
{
char *article[5] = {"the", "a", "one", "some", "any"};
char *noun[5] = {"boy", "girl", "dog", "town", "car"};
char *verb[5] = {"drove", "jumped", "ran", "walked", "skipped"};
char *preposition[5] = {"to", "from", "over", "under", "on"};
char sentence[30];
int choice,i,a,a2,n ,n2,v,p;
srand(time(NULL ));
for(i=0;i<20;i+ +)
{
sentence[0] = '\0';
a = rand()%5;
n = rand()%5;
v = rand()%5;
p = rand()%5;
a2 = rand()%5;
n2 = rand()%5;
strcat(sentence , article[a]);
strcat(sentence , " ");
strcat(sentence , noun[n]);
strcat(sentence , " ");
strcat(sentence , verb[v]);
strcat(sentence , " ");
strcat(sentence , preposition[p]);
strcat(sentence , " ");
strcat(sentence , article[a2]);
strcat(sentence , " ");
strcat(sentence , noun[n2]);
strcat(sentence , ".\n");
printf ("%c");
}
system("PAUSE") ;
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
int main (void)
{
char *article[5] = {"the", "a", "one", "some", "any"};
char *noun[5] = {"boy", "girl", "dog", "town", "car"};
char *verb[5] = {"drove", "jumped", "ran", "walked", "skipped"};
char *preposition[5] = {"to", "from", "over", "under", "on"};
char sentence[30];
int choice,i,a,a2,n ,n2,v,p;
srand(time(NULL ));
for(i=0;i<20;i+ +)
{
sentence[0] = '\0';
a = rand()%5;
n = rand()%5;
v = rand()%5;
p = rand()%5;
a2 = rand()%5;
n2 = rand()%5;
strcat(sentence , article[a]);
strcat(sentence , " ");
strcat(sentence , noun[n]);
strcat(sentence , " ");
strcat(sentence , verb[v]);
strcat(sentence , " ");
strcat(sentence , preposition[p]);
strcat(sentence , " ");
strcat(sentence , article[a2]);
strcat(sentence , " ");
strcat(sentence , noun[n2]);
strcat(sentence , ".\n");
printf ("%c");
}
system("PAUSE") ;
return 0;
}
Comment