User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,133 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,756 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2689 | Replies: 4
Reply
Join Date: Apr 2007
Posts: 17
Reputation: MukeshZ is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
MukeshZ MukeshZ is offline Offline
Newbie Poster

2's complement of BYTE array in c++ or vc++

  #1  
Apr 18th, 2007
Hi,
I want to calculate 2's complement [ Negate all bits + 1] of BYTE array in c++ or VC++
firstly i am adding all elements of BYTE array and assigning it to integer variable now i want to calculate 2's complement of it. How can i do this plz help...
Does anyone know how to convert BYTE to binary format?

Thanks
Mukesh
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,174
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 930
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: 2's complement of BYTE array in c++ or vc++

  #2  
Apr 18th, 2007
>>in c++ or VC++

VC++ is a compiler, not a computer language.

found this with google
Last edited by Ancient Dragon : Apr 18th, 2007 at 5:30 am.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Apr 2007
Posts: 17
Reputation: MukeshZ is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
MukeshZ MukeshZ is offline Offline
Newbie Poster

Re: 2's complement of BYTE array in c++ or vc++

  #3  
Apr 18th, 2007
Originally Posted by Ancient Dragon View Post
>>in c++ or VC++

VC++ is a compiler, not a computer language.
I need it in Visual C++ project or in simple c++
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,174
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 930
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: 2's complement of BYTE array in c++ or vc++

  #4  
Apr 18th, 2007
see my previous answer -- it contains a link
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Apr 2007
Posts: 17
Reputation: MukeshZ is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
MukeshZ MukeshZ is offline Offline
Newbie Poster

Re: 2's complement of BYTE array in c++ or vc++

  #5  
Apr 18th, 2007
Thanks.
can we split the bits of byte data variable. what should i used for it... means which datatype to store the values
like A2 in hex as
162 in Dec

A2 in Binary
1010 0010

I want first 6 bit in one variable and last two in other. can i use shift operator? but how to use with bit ? plz help

Thanks again.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 4:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC