// CS 1621 Fall 2005 // Simple handout demonstrating lack of readability of // nested if statements in C++ // Note that this same problem also exists in Java // This can also be considered a reliability issue since it does not // generate a syntax error and can cause a logic error if used // incorrectly. #include using namespace std; int main() { int score; cout << "Please enter a score:"; cin >> score; if (score <= 100) if (score >= 90) cout << "A" << endl; else // Which if is this associated with? // The language syntax is consistent but the readability // is poor cout << "A+" << endl; return 0; }