When i enter an empty string, the program ends the way it should but it has a weird that comes up and im not sure whats wrong with it.
the message is, (terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr).
If your idea is to enter a blank line to quit you will need to move lines 42 - 44 to line 15 and make it look more like this:
1 2 3 4 5
if (message.length() == 0)
{
on = false;
continue;
}
To end the loop you need to deal with it just after the input i.e., the "getline". The "continue" will cause a jump to end of the do while loop to check the condition causing the loop to end. Next you will have to change line 46 from while(on = true); to while(on ==true);. As it is you assign true to "on" thus making it true and an endless loop. I thing what you meant to do is while (on ==true);. This is the equality operator checking to see if "on" is equal to true.
Hope that helps,
Andy
P.S. be sure to initialize "on" before you use it.