Results 1 to 2 of 2

Thread: how can i perform bitwise AND operation of two binary numbers?

  1. #1
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default how can i perform bitwise AND operation of two binary numbers?

    how can i perform bitwise and operation on two binary numbers?
    Ex: A-->1101
    B-->1011
    Then A AND B-->1001

    I tried like this but getting compilation error saying that error: request for member 'operator&' in 'bin_celVal', which is of non-class type 'int'

    what changes i have to do here?
    Qt Code:
    1. int bin_celVal=BinVal(PrCell);
    2. int bin_Val=BinVal(Val);
    3. int ANDresult= bin_celVal.operator &(bin_Val);
    4. cout<<"RESULT:"<<ANDresult<<endl;
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how can i perform bitwise AND operation of two binary numbers?

    Qt Code:
    1. int ANDresult = bin_celVal & bin_val;
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 10
    Last Post: 30th January 2012, 11:01
  2. how to perform search in QTableWidget?
    By aurora in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2012, 04:25
  3. Bitwise shifting and ORing HexaDecimal Value
    By nagabathula in forum Qt Programming
    Replies: 14
    Last Post: 19th November 2010, 07:22
  4. How to read/write sets of orderded numbers in binary
    By kaydknight in forum General Programming
    Replies: 3
    Last Post: 12th March 2007, 05:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.