C++/Data Type/bit


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

Bit and, or and xor operations

  
#include <iostream>
using namespace std;
int main()
{
 int num1, num2,iand,ior,ixor;
 cout << "Enter an integer \n";
 cin >> num1;
 cout << "Enter another integer \n";
 cin >> num2;
 iand = num1 & num2;
 ior = num1 | num2;
 ixor = num1 ^ num2;
  
 cout << num1 << " AND " << num2 << " is " << iand << endl;
 cout << num1 << " OR " << num2 << " is " << ior << endl;
 cout << num1 << " XOR " << num2 << " is " << ixor << endl;
 return 0;
}