Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: c++ and ASCII  (Read 3171 times)

0 Members and 1 Guest are viewing this topic.

renoroc05

    Topic Starter


    Greenhorn
    c++ and ASCII
    « on: March 28, 2009, 03:26:35 AM »
    hi,

    I need help with how to display the ASCII code for a character in c++. I'm new to the syntax of c++ and it's driving me mad. Also I need a push in the right direction for writing a program that reads in a " " <space> as a character. What sort of data type should I use. I'm not asking for the code for this program just  a push in the right direction, I do want to figure most of it out myself. I guess that I'm stuck atm.

    Thx

    mohammad miyan



      Starter

      Re: c++ and ASCII
      « Reply #1 on: April 27, 2009, 01:03:05 AM »
      main()

      {
      int c;
      c=getch();
      cout<<"\nthe ascii code for the key you pressed   "<<c;

      getch();
      }

      this code will show you the ascii code of the key that you've pressed

      eg  ascii code for a is 65;



      mohammad miyan
      amu
      aligarh