[Solved] strcmp in a function in c++ [closed]


You can’t insert boolean conditions into the function this way:

if (!strcmp( yn , "y" || yn , "Y"))

change the conditions to first evaluate the boolean result of the functions and then perform your logical comparison

if (!strcmp(yn , "y") || !strcmp(yn , "Y"))

Also notice that you’re missing #include <cstring> to use strcmp

solved strcmp in a function in c++ [closed]