...
/Solution Review: Check if the Given Character is an Alphabet
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!
Press + to interact
#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;}
Explanation
Line No. 7: Sets the value of a character
to a
Line No. 10 ...