Question: Starter Code in C++: #include #include #include #include #define MAX_SIZE 100 using namespace std; void BubbleSort (int arr[], int n) { int i, j; int
Starter Code in C++:
#include #include #include #include
#define MAX_SIZE 100
using namespace std;
void BubbleSort (int arr[], int n) { int i, j; int temp; for (i = 0; i j+1. if (arr[j] > arr[j+1]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp;
} } } }
int main(){
string filename; int *data = new int[MAX_SIZE]; int count = 0;
//Your solution here
// Call the sort function here
for(int i=0;i cout
return 0;
} ![namespace std; void BubbleSort (int arr[], int n) { int i, j;](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2ecf3c7c9e_40366f2ecf366f8f.jpg)
Input input.txt Your output Error! opening file output does not contain 34 6 12 22 45 56 94 99 284 pare output a Input input2.txt Your output Error! opening file -output does not contain 79 22 23 26 28 31 31 34 47 50 56 73 80 83 84 92 94 95 96 pare output ^ Input input3.txt Your output Error! opening file -output does not 10 14 15 28 33 33 37 43 44 47 55 58 72 83 95 contain Open a text file and read it. The file would contain integers in each line (total number of integers not exceeding 100). Read all the integers into an integer array. Sort the array in ascending order and then display the integers in a line with space between them. Bubble Sort function is given and does not need to be changed. Sample input file would contain: 12 94 284 99 56 45 Input is: input.txt Output should contain: 34 6 12 22 45 56 94 99 284
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
