Write a C++ program to input N integer numbers into a single dimension array. Sort them in ascending order using the bubble sort technique. Print both the given array and the sorted array with suitable headings. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. Define the sort method in the Sort class. Input Format: The first input consists of an integer which corresponds to the number of elements present in the single dimension array. The next 'n' inputs are the elements in the array. Output Format: The first line output consists of array elements before sorting and the next line of the output consists of array elements after sorting. Refer to sample input and output for formatting specifications. [All text in bold corresponds to input and the rest corresponds to output] Sample Input and Output: Enter the number elements in the array 5 Enter the elements of the array 9 6 7 4 5 Before sorting the array 9 6 7 4 5 After sorting the array 4 5 6 7 9 -------------STRICTLY USE BELOW TEMPLATE IN YOUR SOLUTION------- MAIN.CPP #include #include #include #include #include"Sort.cpp" using namespace std; int main() { //Fill your code here } SORT.CPP #include using namespace std; class Sort { public: int sort(int array[], int n) { //Fill your code here }
------ONLY USE TEMPLATE PROVIDE AT END OF QUESTION YOUR SOLUTION---------
Write a C++ program to input N integer numbers into a single dimension array. Sort them in ascending order using the bubble sort technique. Print both the given array and the sorted array with suitable headings.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.
Define the sort method in the Sort class.
Input Format:
The first input consists of an integer which corresponds to the number of elements present in the single dimension array.
The next 'n' inputs are the elements in the array.
Output Format:
The first line output consists of array elements before sorting and the next line of the output consists of array elements after sorting.
Refer to sample input and output for formatting specifications.
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output:
Enter the number elements in the array
5
Enter the elements of the array
9
6
7
4
5
Before sorting the array
9 6 7 4 5
After sorting the array
4 5 6 7 9
-------------STRICTLY USE BELOW TEMPLATE IN YOUR SOLUTION-------
MAIN.CPP
#include<cstring> #include<iostream> #include<queue> #include<string> #include"Sort.cpp" using namespace std; int main() { //Fill your code here } |
SORT.CPP
#include <bits/stdc++.h> class Sort { |
Step by step
Solved in 3 steps with 1 images