Reading sentences in with char array
I know that i could use a string data type but please don't give that as a solution because strings haven't been covered yet in the book. when i print out the array now, only the first word that is entered shows up. i realize that i have the code set to change every letter to upper case but i was just doing that to test. how do i write code to only change the first letter of each word to upper case using char arrays?
here is code so far: i'm supposed to change the first letter of each word to capital case.
Code:
#include <iostream>
using namespace std;
void upper (char[]);
int main()
{
char proper[21];
cout << "Enter a word: ";
cin >> proper;
upper(proper);
return 0;
}
void upper (char prop[])
{
for (int i = 0; i < 21; i++)
{
if (prop[i] == 0)
break;
prop[i] -= 32;
cout << prop[i];
}
}