Objective The objective of this assignment is to provide hands onexperience of u
ID: 3615019 • Letter: O
Question
Objective
The objective of this assignment is to provide hands onexperience of using
Basic concepts of C++language and Programming
Sorting inc++
Merging arrays
Guidelines
Code should beproperly aligned and well commented.
Follow c/c++rules while writing variables names, function names etc
Use onlydev-C++ for this assignment.
Use appropriatec/c++ structure i.e. loop, if-else, switch statement etc to getinputs from user (Marks will be deducted if inappropriate structurewill be used).
Assignment
Problem Statement: Merging and Sorting of characterarrays
You are required to write a program that takes character valuesin two different arrays as input from user. After getting input,make a third array and merge both these array in third array.Output array must be sorted in ascending order.
1. Declare three character type arrays.
2. Use two arrays to take input from user.
o Take input as chartype.
o Take 10 values in eacharray.
3. Merge both these input arrays.
o If an input character isin both arrays, then it should appear once in resulted array.
4. Store result in third array.
5. Sort resulted array in ascending order.
o Ascending order meansstring values starting from ‘a’ will come first, andthen starting from ‘b’ and so on.
6. Display them after sorting
Sample Output
Enter values in first array: a h b c u v I j k e
Enter values in Second array: y u d f g k I w q a
Merged array: a y h u b d c f g v k I j w q e
Sorted Array in ascending order: a b c d e f g h I j k q uv w y
Objective
The objective of this assignment is to provide hands onexperience of using
Basic concepts of C++language and Programming
Conditionalstatements of C language Arrays in clanguage Char manipulation in c++Sorting inc++
Merging arrays
Guidelines
Code should beproperly aligned and well commented.
Follow c/c++rules while writing variables names, function names etc
Use onlydev-C++ for this assignment.
Use appropriatec/c++ structure i.e. loop, if-else, switch statement etc to getinputs from user (Marks will be deducted if inappropriate structurewill be used).
Assignment
Problem Statement: Merging and Sorting of characterarrays
You are required to write a program that takes character valuesin two different arrays as input from user. After getting input,make a third array and merge both these array in third array.Output array must be sorted in ascending order.
Detailed Description:1. Declare three character type arrays.
2. Use two arrays to take input from user.
o Take input as chartype.
o Take 10 values in eacharray.
3. Merge both these input arrays.
o If an input character isin both arrays, then it should appear once in resulted array.
4. Store result in third array.
5. Sort resulted array in ascending order.
o Ascending order meansstring values starting from ‘a’ will come first, andthen starting from ‘b’ and so on.
6. Display them after sorting
Sample Output
Enter values in first array: a h b c u v I j k e
Enter values in Second array: y u d f g k I w q a
Merged array: a y h u b d c f g v k I j w q e
Sorted Array in ascending order: a b c d e f g h I j k q uv w y
Explanation / Answer
please rate - thanks #include using namespace std; void merge(char[],int, char[],int ,char[],int&); void fill(char[], int&,char[],int,int&); void print(char[],int,string); void input(char[],int,string); void sort(char[],int); bool already(char,char[],int); int main() {char a[10],b[10],c[20]; int asize=10,csize=0,bsize=10; input (a,asize,"array 1"); input (b,bsize,"array 2"); print(a,asize,"Original Array 1"); print(b,bsize,"Original Array 2"); //sort(a,asize); //sort(b,bsize); merge(a,asize,b,bsize,c,csize); print(c,csize,"Merged Array"); sort(c,csize); print(c,csize,"Sorted Merged Array"); system("pause"); return 0; } void print(char a[],int n,string mess) {int i; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.