7.3 ctype.h 문자함수들

공기훈·2021년 9월 13일
0

홍정모의 따배씨

목록 보기
45/49

ctype.h

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <ctype.h>

int main()
{
    char ch;

    while ((ch = getchar()) != '\n')
    {
        if (islower(ch))
            ch = toupper(ch);
        else if (isupper(ch))
            ch = tolower(ch);

        if (isdigit(ch) != 0) // ch가 숫자인 게 True인가
            ch = '*';
        putchar(ch);
    }

    putchar(ch); // last '\n'

    return 0;

}

tutorialspoint 웹에서 함수 확인 가능

profile
be a coding master

0개의 댓글