Thursday, 24 January 2013

program 2-11(58) Print the value of selected characters

// this program give the value of the characters
#include <iostream>
#include <limits>

using namespace std;

int main()
{
    cout << "this program give the ascii value of characters like \n";
    char a = 'a';
    char b = 'b';
    char z = 'z';
    char nl = '\n';
    char xxx;
    cout << "a = " << (int)a << "\n";

    cout << "b = " << (int)b << "\n";

    cout << "z = " << (int)z << "\n";

    cout << "nl = " << (int)nl << "\n";

    cout << "if you want to check value of your desired number than write your number \n";
    cin >> xxx;
    cout << "ascii value of "<< xxx << "  is = "<<(int)xxx;

    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    cin.get();
    return 0;
}

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Enterprise Project Management