codescracker


c++

C++ Program to Print ASCII Values of Characters



« Previous Program Next Program »


Print ASCII Values of Characters in C++

To print ASCII values of all the character in C++ programming, use the number from 1 to 255 and place the number in the ch variable of char type to convert the ASCII value in equivalent character to print all the ASCII values of the characters as shown here in the following program.

C++ Programming Code to Print ASCII Values of Characters

Following C++ program print all the ASCII values of characters:

/* C++ Program - Print ASCII Values of Characters */
		
#include<iostream.h>
#include<conio.h>
void main()
{
	clrscr();
	char ch;
	int i;
	for(i=1; i<255; i++)
	{
		ch=i;
		cout<<i<<"-> "<<ch<<"\t";
	}
	getch();
}

When the above C++ program is compile and executed, it will produce the following result:

C++ program print ascii values

Same Program in Other Language

You may like the same program in other programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test