1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help for programing

Discussion in 'C++' started by p3rsia, Mar 1, 2011.

  1. p3rsia

    p3rsia New Member

    Joined:
    Mar 1, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi all.. i need a program code(C++ , C#, java etc...) to find a union ,intersection,mines of 2 sets... same as
    A={1,2,4,5}
    B={1,3,4,5}
    C={1,2,6,7}
    A U B=...
    A-B= ....
    A-C=.....
    etc...
    Amybody can help me?
     
  2. Scaner

    Scaner New Member

    Joined:
    Mar 14, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi There
    I Will Help You But Let Me First Know All Kind Of Operations You Need In The Program
    Thank You
     
  3. p3rsia

    p3rsia New Member

    Joined:
    Mar 1, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    thx for helping..
    i need a program that get 2 or 3 sets same as A and B and C and give us the
    A U B =
    A intersect B= ( i cant right intersect becouse my keyboard dont have:D )
    A-B=
    C-B-A=
    this 4 thing..
    i mean sets same as A={1,2,3,4..}
     
  4. jsh

    jsh New Member

    Joined:
    Mar 18, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    hi all...
    ..........
    A U B = ..
    javascript:
    ..........
    Code:
    JSH:
    ...
    var sum=new Array();
    for ( var i=1 ; i < A.length ; i++ )
      {
          sum[i]=A[i];
      }
    for ( var j=1 ; j < B.length ; j++ )
      {
         var flag=1;
         for ( var k=1 ; k < sum.length ; k++ )
           {
              if ( B[j]==sum[k] )
                {
                   flag=0;
                   break;
                }
            }
         if (flag==1)
            {
               sum[sum.length]=B[j];
            }
      }
    return sum;  //sum= A u B;
    ...
    
    ...Ok...
    ........
     

Share This Page