Hi

I'm new to C++ and need help urgently.

I need a C++ program that converts letters into ASCII numbers.

For example if I enter a name James Bond the output would be 66 and 74

Thanks

SallyJ

Hi

I'm new to C++ and need help urgently.

I need a C++ program that converts letters into ASCII numbers.

For example if I enter a name James Bond the output would be 66 and 74

Thanks

SallyJ

Typecast the char to an int:

#include <iostream>
using namespace std;

int main ()
{
    char letter = 'B';
    cout << (int) letter;
    return 0;
}

Output will be 66.

Be a part of the DaniWeb community

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