this worked a few times and now its not :( anny help would be greatly appretiated

#include <iostream>
#include <string>

using namespace std;

string vowels(string str)
{
    string vow = "aeiouAEIOU";
    for(size_t i = 0; i <= str.length()+1; i++)
    {
        str.erase((str.find_first_of(vow)),1);
    }
    return str;
}

int main()
{
    string str;
    cout << "Enter a string of charecters." << endl;
    cin >> str;

    vowels(str);

    return 0;
}

http://www.cplusplus.com/reference/string/string/erase/

pos
Position within the string of the first character to be erased.
If the position passed is past the end of the string, an out_of_range exception is thrown.

I see no checking for this condition and I see no catching of any exceptions, so if this is in fact occurring, it would certainly "terminate in a special way". Confirm that this doesn't happen or make sure you prevent and / or handle it.

Edited 5 Years Ago by VernonDozier: n/a

some times all you need is a fresh prespective thanx for that i should have seen it along time ago

This question has already been answered. Start a new discussion instead.