#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string input = "";
string ex = "";
string result = "";
cout << "Input a phase: ";
cin >> input;
for (int i = 0; i < input.length(); i++)
{
string ex = input.substr(i, 1);
if ( ex == "A" || ex == "E" || ex == "I" || ex == "O" || ex == "U" || ex == "a" || ex == "e" || ex == "i" || ex == "o" || ex == "u")
{
cout << "_";
}
else
{
result = input.substr(i, 1);
cout << result;
}
}
return 0;
}
So I made this code for one of the questions my text books asks for, however it stops working as soon as it gets to a space in the string, and gives me an error that is very useless "Abort() has been activated". That being said it works for single words but for some reason still gives me an error. Its a very simple code and I don't feel this is my fault as it the lack of how much the book has actually taught me at this point.