Skip to main content

C++ Program to Display ASCII Value of a Character

Programming Languages

 Welcome to coding world

Write a C++ Program to Display ASCII Value of a Character

Write a C++ Program to Display ASCII Value of a Character. Here’s simple C++ Program to Find ASCII Value of a Character in C++ Programming Language.

A character variable holds ASCII value (an integer number between 0 and 127) rather than that character itself in C programming. That value is known as ASCII value.

 For example, ASCII value of ‘A’ is 65.

 What this means is that, if you assign ‘A’ to a character variable, 65 is stored in that variable rather than ‘A’ itself.

 Here is source code of the C++ Program to Display ASCII Value of a Character. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

SOURCE CODE :

/*  C++ Program to Display ASCII Value of a Character  */

 

#include <iostream>

using namespace std;

 

int main()

{

     char c;

 

     cout << "Enter any Character :: ";

     cin >> c;

 

     cout << "\nThe ASCII Value of Character [ "<< c << " ] is :: " << int(c)<<"\n";

 

     return 0;

}

Output :

/*  C++ Program to Display ASCII Value of a Character  */

 

Enter any Character :: C

 

The ASCII Value of Character [ C ] is :: 67

 

Process returned 0

Above is the source code for C++ Program to Display ASCII Value of a Character which is successfully compiled and run on Windows System. The Output of the program is shown above .

 If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.

Popular posts from this blog

Good Morning Wishes

Ayeza Khan Bridal collection 2021

Pakistan Showbiz Ayeza khan celebrate 10M on Instagram Ayeza Khan & Danish Taimoor love story  

Explore the beauty of Murree | A memorable tour from Lahore to murree | Tour packing tips

Memorable Murree Getaway As we set off from Lahore, the excitement was palpable. The scenic drive to Murree was breathtaking, with lush green hills and winding roads. After a four-hour journey, we arrived in Murree, and the crisp mountain air invigorated us. We spent the day exploring Mall Road, browsing local shops, and savoring delicious food at restaurants. The stunning views of the hills and valleys left us spellbound. As the sun set, we settled into our cozy hotel, feeling grateful for this escape from the city's hustle. The next day, we visited the iconic Patriata Chair Lift (if operational) and took in the panoramic views. Our hotel's scenic location offered breathtaking sunrises and sunsets. As we reluctantly bid farewell to Murree and headed back to Lahore, memories of our time in the hills lingered. The trip was a perfect blend of adventure, relaxation, and rejuvenation. Highlights: - Scenic drive to Murree - Exploring Mall Road and local cuisine - Breathtaking views ...