Type in two characters - C++ File Stream

C++ examples for File Stream:cin

Description

Type in two characters

Demo Code

#include <iostream>
using namespace std;
int main()/*  www.  ja va2  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;
}

Result


Related Tutorials