From de54ca7c31487a33fa8148159e9b3dea96a9dd4c Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 9 Oct 2014 20:44:57 +0100 Subject: cast char --- c,cc/cast_char.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 c,cc/cast_char.cc (limited to 'c,cc') diff --git a/c,cc/cast_char.cc b/c,cc/cast_char.cc new file mode 100644 index 0000000..c3a3315 --- /dev/null +++ b/c,cc/cast_char.cc @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main(void) +{ + int i = 255; + char c = 'x'; + char d = -1; + char e = 255; + char f = 'f'; + char q = 127; + + std::cout << (char)i << std::endl; + std::cout << (int)c << std::endl; + std::cout << (int)d << std::endl; + std::cout << (int)e << std::endl; + std::cout << (int)f << std::endl; + std::cout << (int)q << std::endl; +} + -- cgit v1.2.3