Recently I was assigned to create a function that would return true if the string consisted of uppercase letters. I created this function but however whenever I run it, it states that not all control paths return a value. Could someone explain why it does that?
bool isUppercase(str ing text)
{
for (int k = 0; k < text.size(); k++)
{
if (text[k] = toupper(text[k]) || text =="")
return true;
else
return false;
}
}
bool isUppercase(str ing text)
{
for (int k = 0; k < text.size(); k++)
{
if (text[k] = toupper(text[k]) || text =="")
return true;
else
return false;
}
}
Comment