Schupp icon

shift test 9Bit

Schupp | PRO | 03/22/21 06:57:43 PM UTC | 0 ⭐ | 980 👁️ | Never ⏰ | []
C++ |

840 B

|

None

|

0 👍

/

0 👎

/******************************************************************************
 
                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
 
*******************************************************************************/
 
#include <iostream>
#include <bitset>
using namespace std;
 
int main()
{
    uint16_t test1 = 255;
    uint16_t test2 = 128;
    uint16_t result= test1;
    result = test1+((test2 &128)<<1);
    std::cout << "a = " << std::bitset<8>(test1)  << std::endl;
    std::cout << "a = " << std::bitset<8>(test2)  << std::endl;
    std::cout << "a = " << std::bitset<16>(result)  << std::endl;
    std::cout << "a = " << result  << std::endl;
    cout<<"Hello World";
 
    return 0;
}

Comments