I'm a beginner to c++ and I'm stuck at the very beginning.
The problem is simple: a letter is the input and the output should be "it's uppercase" or "it's lowercase", or simply "error" when it's not a letter.
And that's where I got stuck.
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
char t;
cin>>t;
if (t==toupper(t))cout<<"UPPER";
else if(t==tolower(t))cout<<"LOWER";
else cout<<"ERROR";
return 0;
}
That's my code. I have never worked with chars before. It seems that the program cannot know whether it's text or a number/special symbol. How do I get it to tell me whether the letter is upper, lower or an error?