C++에서 문자와 숫자를 구분하는 함수가 있습니까?

나는오리의 이미지

숫자일땐 TRUE
문자일땐 FALSE

이렇게 리턴을 해주던가

숫자 -1 알파ㅤㅂㅔㅌ +1 특수문자 0
아니면 이렇게 리턴해주는

그런 훌~륭한 함수가 존재할까요?

--;
죄송합니다.
머리 굴리기 싫어서 레퍼런스 사이트 뒤지다가 질문했습니다. ㅠ.ㅠ

익명 사용자의 이미지

욕심많은오리 wrote:
숫자일땐 TRUE
문자일땐 FALSE

이렇게 리턴을 해주던가

숫자 -1 알파ㅤㅂㅔㅌ +1 특수문자 0
아니면 이렇게 리턴해주는

그런 훌~륭한 함수가 존재할까요?

--;
죄송합니다.
머리 굴리기 싫어서 레퍼런스 사이트 뒤지다가 질문했습니다. ㅠ.ㅠ

isalpha

isdigit

...

익명 사용자의 이미지

욕심많은오리 wrote:
숫자일땐 TRUE
문자일땐 FALSE

이렇게 리턴을 해주던가

숫자 -1 알파ㅤㅂㅔㅌ +1 특수문자 0
아니면 이렇게 리턴해주는

그런 훌~륭한 함수가 존재할까요?

--;
죄송합니다.
머리 굴리기 싫어서 레퍼런스 사이트 뒤지다가 질문했습니다. ㅠ.ㅠ

#include <ctype.h>

int isalnum(int c);
int isalpha(int c);
int isascii(int c);
int isblank(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);

나는오리의 이미지

Quote:

isalpha

isdigit

ㅋ~ 이게 왜 생각 안났던걸까요? ㅠ.ㅠ

다음부턴 꼭 ctype.h파일부터 뒤져보겠습니다.

ixevexi의 이미지

Anonymous wrote:
욕심많은오리 wrote:
숫자일땐 TRUE
문자일땐 FALSE

이렇게 리턴을 해주던가

숫자 -1 알파ㅤㅂㅔㅌ +1 특수문자 0
아니면 이렇게 리턴해주는

그런 훌~륭한 함수가 존재할까요?

--;
죄송합니다.
머리 굴리기 싫어서 레퍼런스 사이트 뒤지다가 질문했습니다. ㅠ.ㅠ

#include <ctype.h>

int isalnum(int c);
int isalpha(int c);
int isascii(int c);
int isblank(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);

#include<cctype> 이 아닐까용~~ 텨텨텨

C++, 그리고 C++....
죽어도 C++

lifthrasiir의 이미지

ixevexi wrote:
Anonymous wrote:
욕심많은오리 wrote:
숫자일땐 TRUE
문자일땐 FALSE

이렇게 리턴을 해주던가

숫자 -1 알파ㅤㅂㅔㅌ +1 특수문자 0
아니면 이렇게 리턴해주는

그런 훌~륭한 함수가 존재할까요?

--;
죄송합니다.
머리 굴리기 싫어서 레퍼런스 사이트 뒤지다가 질문했습니다. ㅠ.ㅠ

#include <ctype.h>

int isalnum(int c);
int isalpha(int c);
int isascii(int c);
int isblank(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);

#include<cctype> 이 아닐까용~~ 텨텨텨

둘은 cctype 쪽의 경우 함수들이 namespace std에 몰려 있다는 것만 빼면 완전히 동일합니다.

- 토끼군

ixevexi의 이미지

tokigun wrote:
ixevexi wrote:
Anonymous wrote:
욕심많은오리 wrote:
숫자일땐 TRUE
문자일땐 FALSE

이렇게 리턴을 해주던가

숫자 -1 알파ㅤㅂㅔㅌ +1 특수문자 0
아니면 이렇게 리턴해주는

그런 훌~륭한 함수가 존재할까요?

--;
죄송합니다.
머리 굴리기 싫어서 레퍼런스 사이트 뒤지다가 질문했습니다. ㅠ.ㅠ

#include <ctype.h>

int isalnum(int c);
int isalpha(int c);
int isascii(int c);
int isblank(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);

#include<cctype> 이 아닐까용~~ 텨텨텨

둘은 cctype 쪽의 경우 함수들이 namespace std에 몰려 있다는 것만 빼면 완전히 동일합니다.

- 토끼군

물론 C++표준때문에 그리한 것입니다 8)

C++, 그리고 C++....
죽어도 C++

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.