Word Separator: Write a program that accepts as input a sentence in which all of
ID: 3635265 • Letter: W
Question
Word Separator: Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example the string “StopAndSmellTheRoses.” would be converted to “Stop and smell the roses.”
Explanation / Answer
#include using namespace std; /* Main exec function*/ int main() { char nospace[30]; char sentence[30]; int i, j; /* initialize it all with blanks */ for(i = 0; i < 30; i++) { nospace[i] = ''; sentence[i] = ''; } cout > nospace; i = 0; j = 0; while( i < 30 ) { if(nospace[i] == '') break; if( ((int)nospace[i] >= 65) && ((int)nospace[i] = 97) && ((int)nospace[i]Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.