Line 16: 'input' is a char, not a string. Hence, you cannot dereference it. (Remember, a string is an array of chars.)
Here's a lowercase function you can use:
http://www.cplusplus.com/faq/sequences/strings/case-conversion/#diy
Line 34: Okay, you really need to read up here:
http://www.cplusplus.com/faq/sequences/strings/c-strings-and-pointers/
Also, you really need to check your documentation. istream::getline(), like most stream methods, return the
stream, not the object they modify.
1 2 3 4
|
char input[ 100 ];
cin.getline( input, 100 );
for (char& c : input) c = tolower( c, loc );
|
Line 42: The 'input' variable is a pointer to a character, so while your code is syntactically correct, the compiler is actually catching a semantic error for you -- it is very, very, very,
very unlikely that your 'input' variable will ever have the address of the literal data "end".
You can save yourself a whole lot of grief by using std::string directly instead of character arrays.
You are also making an error by trying to find the
sizeof(input)
. You can read more about how to actually do it here
http://www.cplusplus.com/faq/sequences/arrays/sizeof-array/
but I recommend you don't waste your time.
If you are using c-strings, find the length of the string with
strlen().
If you are using std::string, find the length using
s.length().
Alas, I still cannot help you very well about the "keeping a pointer to each word in an array of pointers", as I still don't know what that means either.
I have two suspicions, which I have already mentioned above. You need to go ask your professor for clarification.
Hope this helps.