Hi, I am stuck and my head is spinning with this project that I am working on for my beginners c++ class. Can someone show me how to work this? Here is the problem:
Write a function that uses an array parameter to accept a string as its argument. It should convert the first letter of each word in the string to uppercase. If any of the letters are already uppercase, they should be left alone. (see hint). Demonstrate the function in a simple program that asks the user to input a string, passes it to a function, and then displays the string after it has been modified.
Here is the work I have so far: How do I just convert the first letter while keeping the rest lowercase or if uppercase leave it alone? also how do I make the numbers display as numbers? Thank you.
#include <iostream.h>
int main()
{
char ch;
cout << "Please enter a word: ";
cin >> ch;
if (ch >= 'A' && ch <= 'Z')
cout >> ch;
else if (ch >= 'a' && ch <= 'z')
cout >> toupper(char ch);