-1
#include <iostream>
using namespace std;

char myChar_1 = 'a';
char myChar_2 = 'b';
char checkChar(char myChar_1,char myChar_2){
    if ((isupper(myChar_1) && isupper(myChar_2)) || (islower(myChar_1) && islower(myChar_2))) {
        return true;
    }
    else{
        return false;
    }

}

int main()
{
    cout << checkChar(myChar_1, myChar_2);

}

The output is an upside-down question mark. Would be great if someone could tell me what I'm doing wrong. Niko

Nikolai Stiksrud
  • 157
  • 2
  • 4
  • 7

1 Answers1

7

Your return type should be bool. You're returning true and false as chars and then outputting that character. When converting from bool to an integral type, true is converted to 1 and false is converted to 0. So you're printing out chars with values of 0 or 1.

Joseph Mansfield
  • 108,238
  • 20
  • 242
  • 324