Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

"How will you merge these two arrays? Write the program
Array: A 1 18 22 43
Array: B 3 4 6 20 34 46 55
Output Array: C 1 3 4 6 18 20 22 34 43 46 55"

Answer Posted / manish podiyal

#include<iostream.h>
class array
{
int a[15],b[15],c[15];
public:
void setdata()
{
a[10]={1,18,22,43,NULL};
b[10]={3,4,6,20,34,46,55,NULL};
}
void output()
{
while(a[i]!=NULL)
{
for(i=0;i<15;i++)
{
if(a[i]< b[i])
{
c[i]=a[i];
i++;
}
else if(a[i] > b[i])
{
c[i]=b[i];
i++;
}
}
}
if(a[i]==NULL)
{
c[i]=b[i];
i++;
}
}
};
void main()
{
array o;
o.setdata();
o.output();
}

Is This Answer Correct ?    28 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do nonglobal variables default to a) auto b) register c) static

1100


What is a linked list in c++?

1002


Which programming language is best?

938


Write a recursive program to calculate factorial in c++.

1028


What is the use of class in c++?

1007


What is a tuple c++?

963


what is the difference between linear list linked representaion and linked representation? what is the purpose of representing the linear list in linked represention ? is it not avoiding rules of linear represention?

2290


How do you clear a map in c++?

1067


What is the benefit of learning c++?

935


Do you know about C++ 11 standard?

1039


How would you implement a substr() function that extracts a sub string from a given string?

996


What are the two shift operators and what are their functions?

1038


Is c++ built on c?

972


What is the difference between a pointer and a link in c ++?

1006


What are punctuators in c++?

1091