Ok I have this code, which I want it convert the string answer into all lowercase letters. I'm using strlwr which you have to use a character array, but when I try to use a character array, it can't be a string(obviously) but when I check if it equals "roll" it doesn't work.
Anyway, i'm not too sure about how to use a cast in this situation, and I would rather not have to, but if it is the only way to get around this, I guess it will have to do.
Code:
int main()
{
srand(time(NULL));
string answer;
do
{
cout<<"Enter A Command";
cin>>answer;
cin.ignore();
strlwr(answer);
if(answer=="roll")
{
roll_dice();
}
}
while(1);
cin.get();
return 1;
}
Whoops. Forgot the error it gives me.
Code:
cannot convert `answer' from type `string' to type `char *'