Remove leading zeros after decimal conversion to binary (and can only be shifted by & | ^)

sources of topics and their own ideas

for example: 8000000000000000000000000000000001000

       1000   & | ^ -sharp-sharp-sharp 

related codes


-sharpinclude <iostream>
using namespace std;
{
        int y;
        cin >> y;
    for (int i = sizeof(y) * 8 - 1; i >= 0; i--)
        {
            bool status = (y >> i) & 1;
            cout << status;
        }cout << endl;
bool start = false;
        for (int i = sizeof(y) * 8 - 1; i >= 0; i--)
        {
            bool status = (y >> i) & 1;
            if (status && !start) 
                start = true;
            if (start) 
                cout << status;
        }
    }

what result do you expect? What is the error message actually seen?

the zero after 1 is gone and there is an extra zero

.
CPP c
Feb.15,2022

first find the first 1, remember the position, and then go from this position to the end, move the corresponding position by 1 to the left each time, and decide whether the output is 0 or 1

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45bbb-664fb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45bbb-664fb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?