Thread: can some one help on matrix - 2D

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    71

    can some one help on matrix - 2D

    hi, can someone please provide me a sample of code that will change the bit in the 2D matrix... for example

    1 0 0 1
    1 0 0 1
    0 1 1 0
    0 1 1 0

    i would like to know some idea on finding another parity of the matrix by chainging a bit and out put the array position.

    will be appreciate ....

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Try searching the board -- I'm sure someone has already asked this question.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Code:
    #include <iostream>
    using namespace std;
    
    int main() 
    {
        int bits[] = {1,0,1};
        for(int i = 0; i<3; i++)
        {
           bits[i] = (bits[i] == 1)? 0:1;
        }
        
        for(int j=0; j<3; j++)
        {
            cout<<bits[j]<<endl;
        }
    
        cin.get();
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM
  3. What is a matrix's purpose in OpenGL
    By jimboob in forum Game Programming
    Replies: 5
    Last Post: 11-14-2004, 12:19 AM
  4. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM