fork download
  1. //Saliha Babar CS1A Chapter 5, Page 294, #2
  2. //
  3. /************************************************************************
  4.  *
  5.  * CHARACTERS OF ASCII CODES
  6.  * ______________________________________________________________________
  7.  * This program displays characters for the ASCII codes 0 through 127
  8.  * in 16 characters in each lines.
  9.  *
  10.  * there is no specific formula related to this program
  11.  * ______________________________________________________________________
  12.  * INPUT
  13.  * no specific input
  14.  *
  15.  * OUTPUT
  16.  * ASCII characters from 0 - 127 in 16 characters in each lines
  17.  *
  18.  * *********************************************************************/
  19.  
  20. #include <iostream>
  21. using namespace std;
  22.  
  23. int main() {
  24.  
  25. int count; // Counter variable
  26. char character; // OUTPUT - character represented by ASCII value
  27.  
  28. for (count = 0 ; count <= 127 ; count++)
  29. {
  30. // Type Casting
  31. character = static_cast<char>(count);
  32. cout << character ;
  33.  
  34. // Format the output
  35. if ((count + 1) % 16 == 0)
  36. {
  37. cout << endl;
  38.  
  39. }
  40.  
  41. else
  42. {
  43. cout << ' ';
  44.  
  45. }
  46. }
  47. return 0;
  48. }
Success #stdin #stdout 0.01s 5284KB
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 { | } ~