Comparing strings inside an if statement. [Solved]

Well, my string is named pick and right after I ask the user to input either "withdrawl" or "deposit" I want to use an if statement to decide which it is. I tried

if ((!(strcmpi(pick, "withdrawl"))

I end up getting an error which is

cannot convert `std::string' to `const char*' for argument `1' to `int strcmpi(const char*, const char*)

What's the right way to compare them?
Last edited on
try:
 
if(pick == "withdrawl"){

you can aply directly the operators +, >=, ==, <= etc to strings...
If you want to use strcmp() use pick.c_str()
strcmp() works only with c type strings.
Thanks, I must've forgotten a bracket or something the first time. I tried doing it like that normally but it gave me an error and it seemed like I needed to use a different command for it. Thanks for the help.
Topic archived. No new replies allowed.