Results 1 to 3 of 3
  1. #1

    Default Set of Operation-Union in Java


    mga istoryans please mangau ko ninyo idea bahin ani kay ang akong code dli man mogana mao ni ako code
    Code:
    public static void Union(char seta[], char setb[], char setc[], int n1, int n2, int n3)
    		{
    			int x, y;
    			char a=0,b=0,c=0;
    			System.out.print("\nUnion: ");
    			for(x=0;x<n1;x++)
    				{
    					for(y=0;y<n2;x++)
    						{
    							if(y<1)
    								{
    									if(seta[x]==setb[y])
    										{
    											a=seta[x];
    											System.out.print(seta[x]);
    										}
    									else
    										{
    										a=seta[x];
    										b=setb[y];
    										System.out.print(seta[x]);
    										System.out.print(seta[y]);
    										}
    								}
    							else if (y==1)
    								{
    									if((seta[y]==a)||(setb[y]==b))
    										continue;
    									else
    										c=setb[y];
    										System.out.print(setb[y]);
    								}
    							else if(y>1)
    								{
    									if(((setb[y]==a)||(setb[y]==b)||(setb[y]==c))&&((setb[y]==a)||(setb[y]==b)||(setb[y]==c)))
    										continue;
    									else
    										System.out.print(setb[y]);
    													}
    
    					}
    				}
    
    
    		}
    wala na lang ko gamit java.util.Set kay wla pa man namo na discuss...

  2. #2
    btw unsaon pag store sa usa ka char sa array? like

    Code:
    for(x=0;x<n1;x++)
    	{
    		for(y=0;y<n2;x++)
    		{
                            if(seta[x]==setb[y])
                         -- store seta[x] in a third array--
    }
    }

  3. #3
    regular array,

    String[] array = {"array1", "array2"};

    or

    String[] array = new String[2];
    //Do some loops if you want;
    array[0] = "array1";
    array[1] = "array2";

    bali imuha, I think..

    in your code, a=seta[x];

    dapat seta[x] = a;

  4.    Advertisement

Similar Threads

 
  1. Freedom of expression here in the Philippines, what can you say?
    By Bolshoi in forum Politics & Current Events
    Replies: 68
    Last Post: 11-24-2015, 03:22 PM
  2. Need help in choosing my first set of speakers...
    By deejayy_214 in forum Computer Hardware
    Replies: 25
    Last Post: 04-22-2013, 10:02 PM
  3. For Sale: 18 sets of Internet Cafe Core2duo unit and Ineo 164 All in one printer
    By willard in forum Computers & Accessories
    Replies: 189
    Last Post: 02-18-2013, 03:37 PM
  4. what do you think of drag racing in cebu
    By mathoj81 in forum Sports & Recreation
    Replies: 94
    Last Post: 07-24-2011, 06:05 PM
  5. why is it that most of the bands in cebu is doing cover?
    By janchrish in forum Music & Radio
    Replies: 52
    Last Post: 09-17-2005, 03:43 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top