bitAnd.cpp

URL: https://mirkwood.cs.edinboro.edu/~bennett/class/cmsc3100/spring2026/notes/binary/code/bitAnd.cpp
 
#include <iostream>
#include <format>

using namespace std;

int main() {

     int a {2 + 4 + 16+ 128};
     int b {2 + 8 + 16+ 32+ 128};

     int c {a & b};

     cout << format("{:b}",a) << " + " 
          << format("{:b}",b) << " = "
          << format("{:b}",c) << endl; 

     return 0;
}