-9

The (char n) would be receive either a "Y" or a "N" from the user.

bool YesNo(char n) //Prototype Function
{
    if (n == "Y")
        return 1; // true
    else
        return 0; //false
}

1 Answers1

2

You are not comparing char, instead you are comparing a string. A char can be compared in following way -

if (n == 'Y')

Just use a single quote for character and double quote for string. Change your if condition as above. It'll work fine.

Naseef Chowdhury
  • 2,357
  • 3
  • 28
  • 52