Solution Review: Check if the Given Character is an Alphabet
Let's see the detailed solution review of the challenge given in the previous lesson.
We'll cover the following...
Solution
Run the code below and see the output!
C++
#include <iostream>using namespace std;int main() {// Initialize variable characterchar character = 'a';// if blockif (character >= 'A' && character <= 'Z') {cout << "upper-case alphabet";}// else if blockelse if (character >= 'a' && character <= 'z') {cout << "lower-case alphabet";}// else blockelse {cout << "not an alphabet";}return 0;}