Functions not working

So I got the first function, is digit to work, but not the others. I'm confused because I used them the same way but obviously, that is incorrect. The other function I want to output like islower('entered letter') = 0. I've tried looking it up but don't see anything that applies to what I'm trying to do. Any recommendations for sites I could look at? Or any reconnections on how I should edit the code? Thanks.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "stdafx.h"
#include <stdio.h>
#include <ctype.h>
#include <cctype>
#include <cstring>


int main()
{
	int c;

	printf("Enter the character: ");
	c = getchar();

	if (isdigit(c) == 0)
	{
		printf
		("User has entered the chacter: %c\n\n", c);
	}

	if (iscntrl(c) == 0)
	{
		printf("User has entered the character = %c\n", c);
	}
	
	if (islower(c) == 0)
	{
		printf("User has entered the character = %c\n", c);
	}

	if (isupper(c) == 0)
	{
		printf("User has entered the character: %c\n", c);
	}

    return 0;
}
Last edited on
Return Value
A value different from zero (i.e., true) if indeed c is a decimal digit. Zero (i.e., false) otherwise.

http://www.cplusplus.com/reference/cctype/isdigit/

if (isdigit(c) == 0) actually translates to if c is not a digit.
Topic archived. No new replies allowed.