Question: iv gotten as far as this #include int readElementsToArray(int array[]) //decide how many inputs will be put into the array { int n; printf(enter elements
![iv gotten as far as this #include int readElementsToArray(int array[]) //decide](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e332ab80f_44266f3e3321ae7c.jpg)
iv gotten as far as this
#include
int readElementsToArray(int array[])
//decide how many inputs will be put into the array { int n; printf("enter elements into the array: "); for(int i = 0; i++;) scanf("%d",&array[i]); return n; }
void printArray(int array[], int n) { for(int i=0; i int EfficientBubbleSort(int A[], int n) { int exchange, i, j, temp; for (i = 0; i int MergeArrays(int A[], int B[], int C[], int n1, int n2) { for(int i = 0; i int main() { int A[20], B[20], C[40], Asize, Bsize, Csize; printf(" Enter elements to first array: "); Asize = readElementsToArray(A); printf(" Enter elements to second array: "); Bsize = readElementsToArray(B); printf(" First array elements in their original order:"); printArray(A, Asize) ; printf(" Second array elements in their original order:"); printArray(B, Bsize) ; EfficientBubbleSort(A, Asize); EfficientBubbleSort(B, Bsize); printf(" First array elements in their sorted order:"); printArray(A, Asize) ; printf(" Second array elements in their sorted order:"); printArray(B,Bsize) ; Csize = MergeArrays(A, B, C, Asize, Bsize); EfficientBubbleSort(C, Csize) ; printf("The new merged array in their sorted order:"); printArray(C, Csize) ; } which works however it requires the input of number elements, is there a way to modify this code so that i nolonger have to input the number of elements befor entering my vector? NOTE: written in C++ the number of elements within each vector must be variable and entered in a continious sequence and the number of elements in each vector should NOT have to be entered
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
