Can someone please help me with this coding? After I press debug it executes the program but then an error message pops stating "string subscript out of range." I've tried everything i could think of but still got no solution.
i dont know which number will be a valid subscript bcuz i dont know exactly what to change to check it. the program is suppose to take a word for, example "there" and remove the vowels so it becomes "thr".. i understand exactly what you want me to do but i just dont know where to make the changes
C++ strings begin at subscript '0', so in string strCat = "cat"; strCat is 'c', strCat is 'a', etc. The length of the string is 3, but the last valid subscript is strCat. What does strCat give you? This is somewhat undefined. So what happens when you do str = str on a string with length 6? Try to amend your logic so you stay within the bounds of the subscript.
i dont understand what you mean by str = str. Your trying to say what happens when you change from 5 to 6? I tried str = str[i+1] and it still gave me the same error even when i changed the 5 to 6 and i used a string with 5, 6, or 7 letters in a word. I understand what you mean by a valid subscript because in the word "there" str would be the last valid subscript but again i dont know exactly where to make the changes to see what happens when i do str = str on a string with length 6.