C++ char type convert to int

Description

C++ char type convert to int

#include <iostream>
using namespace std;
int main()/*from   w w w  .  j a  va  2 s  .  c o m*/
{
   char fkey, skey;
   cout << "Type in a character: ";
   cin.get(fkey);
   cout << "The key just accepted is " << int(fkey) << endl;
   cout << "Type in another character: ";
   cin.get(skey);
   cout << "The key just accepted is " << int(skey) << endl;
   return 0;
}



PreviousNext

Related