' P '

whatever I will forget

C++ C Type Character

C++にはC言語スタイルのcharと、C++スタイルのcharがある。

C言語スタイルの場合は、基本的にcharに最後null terminateがされてることが条件となる。

Character Functions

#include <cctype> をincludeすれば、charを変換するfucntionが使用できるようになる。
例えば、下記。

isalpha()
isalnum()
isdigit()
islower()
isprint()
ispunct()
isupper()
isspace()
tolower()
toupper()

funtionに渡したcharが、数字なのか等を知らせてくれるfunction。
返り値はtrue/false。 touppser/lowerに関してはcharを大文字、小文字に変換してくれる。

で、Cスタイルのcharでcopyとかcmpareとかしたい場合は、下記をincludeしておく
#include<cstring>

加えて、charをfloatやintに変換したい場合も下記をincludeしておく
#include<cstdlib>