I don't understand the problem here. I've researched it, it compiles fine but when I run the program it gives me the "Debug Assertion Failed!" error and the above explanation.
#include <iostream>
#include <string>
using namespace std;
bool checkVowel(char ch)
{
switch(ch)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
return true;
default:
return false;
}}
int main()
{
string str;
char ch;
cout<<"Please enter a string, all vowels will be removed: ";
cin >> str;
for (int i=0;i=str.length();i++)
{
if (checkVowel(str[i]))
{
str=str.erase(i);
}}
cout << str;
}
ifloop. Usewhileand don't incrementiif you callerase.)