void main()
{
std::string myString ("heLlo this is a tEsT VI"

;
std::string::size_type len = myString.length();
int a = 1;
for (int x = 0; x < len; x++)
{
int c = myString[x];
if (a)
{
c = toupper(c);
a = 0;
}
else
c = tolower(c);
if (c == 0x20)
a++;
myString[x] = (char) c;
}
unsigned int loc = myString.find_last_of(" "

;
if (loc != std::string::npos)
{
std::string b = myString.substr(++loc);
std::transform(b.begin(), b.end(), b.begin(), tolower);
if (b == "i" || b == "ii" || b == "iii" || b == "iv" || b == "v" || b == "vi"

{
for (x = loc; x < len; x++)
myString[x] = toupper(myString[x]);
}
}
std::cout << myString << std::endl;
}
This is what I came up with and was wondering if it could be optimized?