Display all the ASCII characters using for loop - C++ Data Type

C++ examples for Data Type:char

Description

Display all the ASCII characters using for loop

Demo Code

#include <iostream>
using namespace std;
int main() {/*  www.  j  a  v  a 2s .co m*/
   for(int i = 0; i < 128; i = i + 1)  {
      if (i != 26){  // ANSI Terminal Clear screen
         cout << " value: " << i
      << " character: "
      << char(i) // Type conversion
      << endl;
   }
}
}

Result


Related Tutorials