//Sam Trivikraman CS1A Chapter 10, p. 589, #5
//
/*
******************************************************************************
Capitalize the First Letter
_______________________________________________________________________________
This program capitalizes the first letter of each sentence in a string.
_______________________________________________________________________________
INPUT
the string of words : The sentences contained within a cstring.
OUTPUT
the capitalized version of the array : The same string, but with the first letter of each starting word capitalized
_______________________________________________________________________________
*******************************************************************************
*/
#include <iostream>
using namespace std;
//Function that capitalizes the first letter of each starting word
void capital (char sentence[])
{
//iterate through the string and capitalize the correct letters
for(int i = 0; i < 100; i++)
{
if(ispunct(sentence[i]))
{
toupper(sentence[i + 2]);
}
}
//output the new string
cout << sentence << endl;
}
int main() {
char words[100]; //INPUT The sentences contained within a cstring
//Ask the user for a string of sentences
cout << "Please enter a string: " << endl;
cin >> words;
//call the capitalization function
capital(words);
return 0;
}