Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Merging Of Array (http://www.go4expert.com/forums/merging-of-array-t24993/)

angad_aks 16Feb2011 01:37

Merging Of Array
 
Code:

import java.io.*;
class merge_array
{
public static void main(int a, int b)throws IOException
{
int c;
int A[] = new int[a];
int B[] = new int [b];
c = a+b;
int C[]= new int[c];
for(i=0; i<a; i++)
{
A[i] = Iteger.parseInt(in.readLine());
    }
    for(j=0;j<b; j++)
    {
        B[j]=Integer.parseInt(in.readLine());
    }
    for(i=0;i<a;i++)
    {
        c[i]=A[i];
    }
    for(j=0; j<b;j++)
    {
        c[i]=B[j];
        i++;
    }
}
    }


xpi0t0s 16Feb2011 14:38

Re: Merging Of Array
 
This is Java, not C++. If you're going to post demo code, you should at least get the language right. If we don't have a Java forum, that means we're not interested in Java demo programs, right?

shabbir 16Feb2011 16:42

Re: Merging Of Array
 
Moved to Java forum

angad_aks 16Feb2011 21:43

Re: Merging Of Array
 
thanks admin. many thanx 4 encouraging

lionaneesh 17Feb2011 01:15

Re: Merging Of Array
 
Quote:

Originally Posted by angad_aks (Post 79428)
thanks admin. many thanx 4 encouraging

angad you should understand the point 'xpi0t0s' want to say...We have told you and others too in previous posts that if you want to post sample code..

It should be some thing different or at least it should have some great commenting so as to make the viewers understand!!!

virxen 19Feb2011 03:33

Re: Merging Of Array
 
Quote:

Originally Posted by angad_aks (Post 79353)
Code:

import java.io.*;
class merge_array
{
public static void main(int a, int b)throws IOException
{
int c;
int A[] = new int[a];
int B[] = new int [b];
c = a+b;
int C[]= new int[c];
for(i=0; i<a; i++)
{
A[i] = Iteger.parseInt(in.readLine());
    }
    for(j=0;j<b; j++)
    {
        B[j]=Integer.parseInt(in.readLine());
    }
    for(i=0;i<a;i++)
    {
        c[i]=A[i];
    }
    for(j=0; j<b;j++)
    {
        c[i]=B[j];
        i++;
    }
}
    }



and the question is?


All times are GMT +5.5. The time now is 08:08.