I know the function has to return an integer, but in it, I print letter by letter in capital, and it also prints out the 0 that I am forced to return. I tried referencing void capital(string& _name)
but this just gave me tons of errors. I think I need to return something inside the for
, but I have no more ideas. What can I do?
int capital(string& _name){
locale loc;
for(std::string::size_type i = 0; i < _name.length(); i++){
cout << std::toupper(_name[i], loc);
}
return 0;
}
int main(){
string name = "robbie";
cout << capital(name) << endl;
system("pause");
return 0;
}