Read a character using cin - C++ File Stream

C++ examples for File Stream:cin

Description

Read a character using cin

Demo Code

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

Result


Related Tutorials