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

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

Develop a C program that sorts two integer vectors and merges the integer elements in the two sorted vectors into a single merged vector. The C program first asks the user to input the integer elements ofthe two vectors. Then the program sorts the integer elements of the two vectors in order to generate two sorted vectors. The program generates a single vector by merging the two sorted vectors. The following illustrates notions of the sorting and the merging. 5 6 9 71 2 8 4 3 1 N Lsorting sorting The two sorted integer vectors 9 7 61 5 8 4 3 2 1 merging The single merged vector 9 8 7 6 5 4 3 21 11 Here is a sample run ofthe program 2017 engineering Programming laboratory Enter the integer elements of the first vector 5 69 7 The firts sorted vector 2 8 4 3 1 The merged vector 9 8 7 6 5 4 3 2 1 Here is another sample run of the program: ng 2017 engineering programming'Laboratory sheetaLab test MquestionivDebugMquestionlewe nter the integer elements of the firs 8 1 49 2 4 1 vector The firts vector 9 10 12 70 80 73 61 1000 24 12 10 The merged vector 1000 80 73 70 61 24 12 10 9 9 8 4 4 2 1 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!