0

/ This is the header file If i try to get input , it is not comparing it./

bool read_boolean(string prompt) {

string result;
result = read_string(prompt);
string to_lowercase(const string &text);
if (result == "yes" or "y")
{
    write_line("Value is updated");
}
else if (result == "no" or "n")
{
    write_line("false");

}

return 0;

}

Blastfurnace
  • 18,411
  • 56
  • 55
  • 70
  • C != C++ ... `if (result == "yes" or "y")` doesn't do what you think, switch to`if (result == "yes" or result == "y")` in C++, in C you want `if (strcmp("yes", result) == 0 || result[0] == 'y')` – David Ranieri Dec 19 '20 at 05:20
  • And what are you trying to do with `string to_lowercase(const string &text);`? It seems like an unused prototype, check https://stackoverflow.com/questions/313970/how-to-convert-stdstring-to-lower-case – David Ranieri Dec 19 '20 at 05:26
  • I am trying to convert the input in lower case using string to_lowercase(const string &text); – Param Dhillon Dec 19 '20 at 05:32

0 Answers0