Code Snippets C/C++ Code Snippets

C++ program to print ASCII value of a character.

By: IncludeHelp, On 11 OCT 2016

In this program we will learn how to print ASCII value of a character?

In this program there is a character type variable x which has "A", we can print the ASCII value of "A" by converting the type of value x.

C++ program (Code Snippet) - Get ASCII of a Character

Let’s consider the following example:

/*C++ program to print ASCII value of a character*/

#include<iostream>

using namespace std;

int main(){
	char x;
	x='A';
	
	cout<<"ASCII value of "<<x<<" is "<<(int)x<<endl;
	
	return 0;
}

Output

    ASCII value of A is 65


Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.