Create a program that will accept a character and display its ASCII value.

Recommended Answers

I'm not going to do your homework for you, but here is a way to output a char's numerical respresentation:

std::cout << (int)someChar;

Jump to Post

All 3 Replies

I'm not going to do your homework for you, but here is a way to output a char's numerical respresentation:

std::cout << (int)someChar;

To output in hex: std::cout << std::hex << (int)someChar;

The function toascii can show ASCII values too: int toascii(int c);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.