Using a nested if with char type : char « Data Types « C++ Tutorial






#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main() {
  char letter = 'S';                      

  if(letter >= 'A') {                   
    if(letter <= 'Z') {                 
      cout << "You entered an uppercase letter."
           << endl;
      return 0;
    }
  }

  if(letter >= 'a')                     
    if(letter <= 'z') {                 
      cout << "You entered a lowercase letter."
           << endl ;
      return 0;
    }
  return 0;
}
You entered an uppercase letter.








2.19.char
2.19.1.char and unsigned char
2.19.2.Write Charset To File
2.19.3.DO while loop: use char type variable to control
2.19.4.Using a nested if with char type