#include #include using namespace std; void display(const bool *p); //function declaration int main() { //The number of bits in the input number and the output number const size_t n {3}; const bool input[n] { 1, //the one's place 1, //the two's place 1 //the four's place }; cout << "The input number is "; display(input); cout << ".\n"; bool carry {1}; bool output[n]; output[0] = input[0] ^ carry; //bitwise exclusive or carry = input[0] & carry; //bitwise and output[1] = input[1] ^ carry; //bitwise exclusive or carry = input[1] & carry; //bitwise and output[2] = input[2] ^ carry; //bitwise exclusive or carry = input[2] & carry; //bitwise and cout << "The output number is "; display(output); cout << ".\n"; return EXIT_SUCCESS; } void display(const bool *p) //function definition { cout << 4 * p[2] + 2 * p[1] + 1 * p[0]; }