Xor operation between two BitArray : BitArray « Collections « Visual C++ .NET

Home
Visual C++ .NET
1.2D
2.Class
3.Collections
4.Data Type
5.Database ADO.net
6.Delegate
7.Development
8.File Directory
9.Function
10.Generics
11.GUI Form
12.Language Basics
13.Network
14.Reflection
15.Security
16.Statement
17.Structure
18.Thread
19.XML
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Visual C++ .NET » Collections » BitArray 
Xor operation between two BitArray
 

#include "stdafx.h"
using namespace System;
using namespace System::Collections;

void PrintBitArray ^barray, String ^desc)
{
    Console::WriteLine(desc);

    int i = 0;
    for eachbool^ val in barray )
    {
        Console::Write("{0} ", val);

        if (++i > 7)
        {
            Console::WriteLine();
            i = 0;
        }
    }
    Console::WriteLine();
}

void main()
{
    BitArray ^barray1 = gcnew BitArray8true );
    Print(barray1, "BitArray( 8, true );");

    BitArray ^barray2 = gcnew BitArray8true );
    barray2->And(barray1);
    Print(barray2, "And with BitArray( 8, true )");
    
    barray2->SetAll(true);
    barray2->Xor(barray1);
    Print(barray2, "XOr with BitArray( 8, true )");
}

   
  
Related examples in the same category
1.Creating BitArray
2.Set value in BitArray by indexer
3.Not on value in BitArray
4.And operation for two BitArray
5.Set all value in BitArray to true
6.Or operation between two BitArray
7.Creating BitArray from array
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.