summaryrefslogtreecommitdiff
path: root/c,cc
diff options
context:
space:
mode:
Diffstat (limited to 'c,cc')
-rw-r--r--c,cc/cast_char.cc21
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;
+}
+