The purpose of the program is to take the sentence in the "sentence string" and capitalize the first letter in the beginning of each sentence. The program can successfully capitalize "hello", but not the other letters. The problem seems to be coming from the for loop and the sentenceArray.
At line 21, you make sentenceArray[i + 2] upper-case. However, that element of sentenceArray hasn't even been given a value yet, so it's a meaningless thing to do!
Then, 2 iterations later, you overwrite it on line 14 with the original letter from sentence[i].
Also, line 14 will make every occurrence of 'h' upper-case, regardless of where it appears in the string. Or at least, it would if it wasn't for the first problem.