/* File: boolExprs.cpp * example of two boolean expressions: * math. notation: 'a' <= ch <= 'z' * C++ notation: ch >= 'a' && ch <= 'z' * both expressions compile, but only the latter is correct * covered in class week 3 */ #include using namespace std; //main() ------------------------------------------ // int main(){ char ch; // lower case letter entered by user //prompt and read cout << "enter ch: "; cin >> ch; if ('i' <= ch <= 'n') cout << "'i' <= ch <= 'n' is true" << endl; if (ch >= 'i' && ch <= 'n') cout << "ch >= 'i' && ch <= 'n' is true" << endl; else cout << "ch >= 'i' && ch <= 'n' is false " << endl; return 0; }