diff options
-rw-r--r-- | c,cc/cast_char.cc | 21 |
1 files changed, 21 insertions, 0 deletions
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 <iostream> + +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; +} + |