Begginer

  • Thread starter Thread starter Eagle006
  • Start date Start date
E

Eagle006

Hi folks. I'm trying to learn c++ on my own.
Can somebody help me with a problem I found on one of the
texts I'm using.

A library function, is lower(), takes a single character
(a letter) as an argument and returns nonzero integer if
the letter is lowercase, or zero if it is uppercase. This
function requires the header file CTYPE.H Write a program
that allows the user to enter a letter, and then displays
either zero or nonzero, depending on whether a lowercase
or uppercase letter was entered.


Thanks in advance
 
How old is you book? ctype.h is no longer valid c++

Try something like this:
#include <cctype>
#include <iostream>

using namespace std;

int main() {
char c;
while(cin >> c)
cout << (islower(c) ? "1" : "0") << endl;
}
 
Back
Top