Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed The multiplication from the older discharge with a shift to the left

–1 vote
asked Jun 25, 2019 by Олександр Ломако (230 points)
closed Jun 25, 2019 by Олександр Ломако
Hello everybody! Such a problem: it is necessary to realize the multiplication from the older discharge with a shift to the left.

Here is the part of the code where I "realized" it, but the program displays the wrong result. Tell me where the mistake is, please...

My code:

........

int result;

for (int n=sizeof(int)*2; n; n--){

  if ((b>>(n-1))&0x01){

  int c=a&a, d=a^a, e;                      

while(c^(e=c|((c<<1)&d))){               

c=e;    

}                                            

result=(c<<1)^d;    

    result=result<<1;

    result=result+a;

    }else       {

  result=result<<1;

}

  }

  cout<<"##########\n"<<result<<endl;

.........
closed with the note: -
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...