C++ if statement nesting
#include <iostream> int main()/*from w w w . j a v a2 s . c o m*/ { char letter {}; // Store input here std::cout << "Enter a letter: "; // Prompt for the input std::cin >> letter; if(letter >= 'A') { // Letter is 'A' or larger if(letter <= 'Z') { // letter is 'Z' or smaller std::cout << "You entered an uppercase letter." << std::endl; return 0; } } if(letter >= 'a') // Test for 'a' or larger if(letter <= 'z') { // letter is >= 'a' and <= 'z' std::cout << "You entered a lowercase letter." << std::endl; return 0; } std::cout << "You did not enter a letter." << std::endl; }