I wrote a program for a class assignment that is supposed to use random number generator to produce sentences. The program has to use four arrays of (pointers to char) and each chosen word must be concatenated to the previous words in an array that has to be able to hold an entire sentence. The sentence also has to begin in a capital letter and end with a period. The number of letters in the array cannot be pre-counted so that the program can be easily modifiable.
Well, I wrote the program, resolved most of the build errors, and then I got 6 occurrences of error C2664. I've tried multiple methods of resolving this and I can't figure it out (probably because this is only my second semester using C++ and it's my independent study class). Would you happen to know how to fix this? Thanks so much!
.\main.cpp(32) : error C2664: 'getSize' : cannot convert parameter 1 from 'const char *[6]' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
The code for the line (and function) are as follows:
const char* article[]={"the", "a", "one", "some", "every", "any"};
const char* noun[]={"boy", "girl", "monkey", "LU", "car"};
const char* verb[]={"drove", "jumped", "ran", "walked", "bit", "slithered"};
const char* prep[]={"to", "from", "over", "under", "on"};
...
sentence = article[(1 + rand()%getSize(article))] + " " +
noun[(1 + rand()%getSize(noun))] + " " +
verb[(1 + rand()%getSize(verb))] + " " +
prep[(1 + rand()%getSize(prep))] + " " +
article[(1 + rand()%getSize(article))] + " " +
noun[(1 + rand()%getSize(noun))] + ".";
...
int getSize(const char* s)
{
int size;
for (size=0; *s != '/0'; s++)
size++;
return size;
}