Hi,
I have an assignment to convert the first character of each word to a upper case letter in a sentence "To be or not to be";
Could you please explain to me - why?
What is wrong here
Thanks a lot,
Alla
Here is my code that is not working
#include<iostream>
#include<string.h>
using namespace std;
int main(){
int afterSpace = ' ';
char list[5000] = "To be or not to be";
char word[5000];
int j = 0;
int i = 0;
while(list[i] != '\0')
{
while(list[i] >= 'a' && list[i] >= 'z')
word[j] = list[i++];
}
if(afterSpace){
word[j] -=32;
}
else {
word[j++];}
cout <<"The new string is: " ;
cout << word[j];
return 0;
}
