SWEG


SUBMITTED BY: Guest

DATE: Dec. 16, 2013, 12:57 p.m.

FORMAT: C++

SIZE: 3.1 kB

HITS: 895

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. /*
  68. The standard ASCII table defines 128 character codes (from 0 to 127), of
  69. which, the first 32 are control codes (non-printable), and the remaining 96
  70. character codes are representable characters:
  71. */
  72. #include <iostream>
  73. #include <iomanip>
  74. using namespace std;
  75. int main()
  76. { int i,j;
  77. char cmd[32][4]= {"NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","TAB",
  78. "LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK",
  79. "SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US"};
  80. cout << "The standard ASCII table defines 128 character codes (from 0 to 127),";
  81. cout << "\n of which,the first 32 are control codes (non-printable), and the";
  82. cout << "\n remaining 96 charactercodes are representable characters:\n";
  83. cout << "*";
  84. for( i = 0 ; i < 10 ; i++)
  85. cout << setw(4) << i;
  86. for( i = 0x41 ; i < 0x47 ; i++)
  87. cout << setw(4) << static_cast<char>(i);
  88. cout << endl << "-- ";
  89. for( i = 0 ; i < 16 ; i++)
  90. cout << left << "--- ";
  91. for( i = 0 ; i < 2 ; i++ )
  92. {
  93. cout << endl << i << "| " ;
  94. for(j = 0 ; j < 16 ; j++)
  95. cout << setw(4) << left << cmd[i*16+j];
  96. }
  97. for( i = 2 ; i < 8 ; i++ )
  98. {
  99. cout << endl << i << "| " ;
  100. for( j = 0 ; j < 16 ; j++)
  101. if((i*16 + j) != 127 )
  102. cout << setw(4) << left << static_cast<char>(i*16+j);
  103. }
  104. cout << endl << endl;
  105. return 0;
  106. }
  107. /*Program's output
  108. The standard ASCII table defines 128 character codes (from 0 to 127),
  109. of which,the first 32 are control codes (non-printable), and the
  110. remaining 96 charactercodes are representable characters:
  111. * 0 1 2 3 4 5 6 7 8 9 A B C D E F
  112. -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
  113. 0| NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI
  114. 1| DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
  115. 2| ! " # $ % & ' ( ) * + , - . /
  116. 3| 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
  117. 4| @ A B C D E F G H I J K L M N O
  118. 5| P Q R S T U V W X Y Z [ \ ] ^ _
  119. 6| ` a b c d e f g h i j k l m n o
  120. 7| p q r s t u v w x y z { | } ~
  121. Process returned 0 (0x0) execution time : 0.078 s
  122. Press any key to continue.
  123. */

comments powered by Disqus