fork download
  1. //Diego Martinez CSC5 Chapter 5, P.294, #2
  2. /*******************************************************************************
  3. * DISPLAY ALL ASCII CHARACTERS
  4. * ______________________________________________________________________________
  5. * The program displays all standard ASCII characters (from code 0 to 127) in a
  6. * neatly organized format, showing 16 characters on each line so the output is
  7. * easy to read.
  8. *
  9. * Computation is based on the Formula:
  10. * The output is based on the ASCII table, which is a predefined mapping between
  11. * numbers (0–127) and characters (like letters, digits, and symbols).
  12. *______________________________________________________________________________
  13. * INPUT
  14. * NO INPUT
  15. *
  16. * OUTPUT
  17. * Letters : (A–Z, a–z)
  18. * Numbers : (0–9)
  19. * Symbols : (like !, @, #, etc.)
  20. * Some non-printable characters : (from codes 0–31)
  21. *******************************************************************************/
  22. #include <iostream>
  23. using namespace std;
  24.  
  25. int main() {
  26. int count = 0;
  27.  
  28. for (int i = 0; i <= 127; i++) {
  29. cout << (char)i << " ";
  30. count++;
  31.  
  32. // Print 16 characters per line
  33. if (count % 16 == 0) {
  34. cout << endl;
  35. }
  36. }
  37.  
  38. return 0;
  39. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
         	 
   
   
                
  ! " # $ % & ' ( ) * + , - . / 
0 1 2 3 4 5 6 7 8 9 : ; < = > ? 
@ A B C D E F G H I J K L M N O 
P Q R S T U V W X Y Z [ \ ] ^ _ 
` a b c d e f g h i j k l m n o 
p q r s t u v w x y z { | } ~