Okay, so I'm basically trying to create a C++ program that determines the case of the letter. The program will basically ask for a letter input, uppercase or lowercase and then the program will say whether that letter the user inputted is an uppercase or a lowercase letter. Help is advised. Thank you.
Input:
#include <iostream>
using namespace std;
int main()
{
char ch;
cout << "Enter any character, lowercase or uppercase: ";
cin >> ch;
if ('A' != 'z')
cout << "The character just entered is a lowercase letter." << endl;
else if('a' != 'Z')
cout << "The characer just entered is not a lowercase letter." << endl;
else
cout << "An invalid character was entered." << endl;
system ("PAUSE");
return EXIT_SUCCESS;
return 0;
}
Output: LOWERCASE WORKS FINE
Enter any character, lowercase or uppercase: a
The character just entered is a lowercase letter.
Press any key to continue . . .
Output: UPPERCASE DOESN'T WORK
Enter any character, lowercase or uppercase: A
The character just entered is a lowercase letter.
Press any key to continue . . .
_______________________________________________
If I switch
if ('A' != 'z')
To instead of (!=) to (<), the program will flip over saying this.
Output: LOWERCASE DOESN'T WORK
Enter any character, lowercase or uppercase: a
The character just entered is not a lowercase letter.
Press any key to continue . . .
Output: UPPERCASE WORKS FINE
Enter any character, lowercase or uppercase: A
The character just entered is not a lowercase letter.
Press any key to continue . . .
_______________________________________________________
The exact same results appear if I switch this
else if('a' != 'Z')
Thank you for helping. I'm just a beginner in C++