Consider A,B,C as three arrays of size m,n and m+n respectively. Array A is stored in ascending order where as array B is stored in descending order. Write a c++ program to produce a third array C, containing all the data of arrays A and B and arranged in descending order. Display the data of array C only.
1
Expert's answer
2015-08-14T02:57:13-0400
#include <iostream>
using namespace std;
void BubbleSort(int* arr, int size);
int main() {
const int n = 7; const int m = 6; int A[] = {45, 47, 55, 78, 81, 90, 102}; int B[] = {134, 122, 116, 90, 71, 34};
int* C = new int [n+m];
for (int i = 0; i < n+m; i++) { if (i >= n) C[i] = B[i - n]; else C[i] = A[i]; }
Comments