[TIL] 따배씨 8일차

4114 단어 TILCC

문자형 char type

아스킷 코드

#include <iostream>

int main()
{
	using namespace std;

	char c1(65);
	char c2('A');

	cout << c1 << " " << c2 << " " << int(c1) << " " << int(c2) << endl;

	//c-style casting
	cout << (char)65 << endl;
	cout << (int)'A' << endl;

	//cpp style
	cout << char(65) << endl;
	cout << int('A') << endl;

	cout << static_cast<char> (65) << endl;
	cout << static_cast<char> ('A') << endl;

	
	return 0;
}

좋은 웹페이지 즐겨찾기