1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Put the code you need help with here.
#include<iostream>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cctype>
using namespace std;
void main()
{
char article[5][5] = { "the", "a", "one", "some", "any" };
char noun[5][5] = { "boy", "girl", "dog", "town", "car" };
char verb[5][8] = { "drove", "jumped", "ran", "walked", "skipped" };
char preposition[5][6] = { "to", "from", "over", "under", "on" };
char sent[36];
int i;
srand(time(NULL));
for (i = 1; 1 < 10; i++)
{
strcpy_s(sent, article[rand() % 5 + 1]);
strcat_s(sent, " ");
strcat_s(sent, noun[rand() % 5 + 1]);
strcat_s(sent, " ");
strcat_s(sent, verb[rand() % 5 + 1]);
strcat_s(sent, " ");
strcat_s(sent, preposition[rand() % 5 + 1]);
strcat_s(sent, " ");
strcat_s(sent, article[rand() % 5 + 1]);
strcat_s(sent, " ");
strcat_s(sent, noun[rand() % 5 + 1]);
strcat_s(sent, ".");
cout << sent << endl;
}
|