C++
How do I use ASC II in order to see if an alphabet is lowercase or uppercase?
Please show me how to do this.
#include <iostream> using namespace std; int main() { char ch; cout << "Enter a single character: "; cin >> ch; if (ch >= 'a' && ch <= 'z') { // we can simply compare with 'a' and 'z' see if character is in the range of lowercase cout << ch << " is lowercase" << endl; } else if (ch >= 'A' && ch <= 'Z') { // we can simply compare with 'A' and 'Z' see if character is in the range of uppercase cout << ch << " is uppercase" << endl; } else { cout << ch << " is neither lowercase not uppercase" << endl; } return 0; }
Get Answers For Free
Most questions answered within 1 hours.