Language & API/C_기초

toupper(_In_ int _C) 사용법

강한퓨전 2017. 6. 12. 14:29

선언 

<cctype> or <ctype.h>


정의

_Check_return_ _CRT_JIT_INTRINSIC _CRTIMP int __cdecl toupper(_In_ int _C);


설명

char 형 소문자를 -> 대문자로 변환시켜 줍니다.

반환값이 Int 입니다.


파라미터 

_In_ int _C : 아스키 코드값(int) or ' ' char 문자 


반환값

Int 형 아스키 코드값 (**문자가 아닙니다.)


예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <cctype>
#include <string.h>
#include <iostream>
//#include <windows.h>
 
using namespace std;
 
int main(_In_ int _Argc, _In_reads_(_Argc) _Pre_z_ char ** _Argv, _In_z_ char ** _Env)
{
    char str[] = "hello world!@@";
 
    for (int i = 0; i < strlen(str); i++)
    {
        cout << static_cast<char>(toupper(str[i]));
        //printf("%c", tolower(str[i]));
    }
    cout << endl;
    system("pause");
    return 0;
}
cs


결과 



틀린 곳이 있거나 더 좋은 의견이 있으시면 댓글 부탁드립니다.