Advertisement
niks32

169

Apr 14th, 2020
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. // nikita169.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "iostream"
  6. #include "Windows.h"
  7. #include <conio.h>
  8.  
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12.     SetConsoleCP(1251);// установка кодовой страницы win-cp 1251 в поток ввода
  13.     SetConsoleOutputCP(1251); // установка кодовой страницы win-cp 1251 в поток вывода
  14.  
  15.     std::cout << "Введите символ" <<
  16.         std::endl << "Для завершения введите точку." << std::endl;
  17.  
  18.     int tempChar = 0;
  19.     bool loopSwicher = true;
  20.  
  21.     while (loopSwicher) {
  22.         std::cout << "-> ";
  23.         tempChar = _getch();
  24.         if (tempChar == 46) {
  25.             loopSwicher = false;
  26.         }
  27.         else {
  28.             std::cout << "Символ: " << (char)tempChar << " Код: " << tempChar << std::endl;
  29.         }
  30.     }
  31.  
  32.     std::cout << "Нажмите любую кнопку...";
  33.     _getch();
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement