fork download
  1. #include <iostream>
  2. #include <cstdint>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char ch;
  9. cout << "Type a character: ";
  10. cin >> ch;
  11. cout << "ASCII code: " << static_cast<int16_t>(ch) << endl;
  12. if (!cin.eof())
  13. cout << "There are some characters more in stdin file object\n";
  14. char next_ch;
  15. cin.ignore(INT64_MAX, '\n');
  16. //fflush(stdin);
  17. cin >> next_ch;
  18. cout << "The next character: " << next_ch << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 4356KB
stdin
Standard input is empty
stdout
Type a character: ASCII code: 0
The next character: