Answered step by step
Verified Expert Solution
Question
1 Approved Answer
update the program to this Modify 2.cpp. Add Sort menu item. The sort menu item will use the Radix algorithm to sort the data. Modify
update the program to this Modify 2.cpp. Add Sort menu item. The sort menu item will use the Radix algorithm to sort the data. Modify the Min / Max menu options to be O(1). Save the file as 3.cpp and also the number of iteration should be 50 Data.txt can be any 50 integers modifying the file 2.cpp #include#include #include using namespace std; #define MAX_SIZE 50 void createData(){ srand(time(0)); // set the seed for the random ofstream outfile("data.txt"); // open the file data.txt if not opened show error if (!outfile){ cout<<"Some error occured in opening file data.txt"< remainingMax) return arr[n-1]; else return remainingMax; } } void display(int arr[], int size){ cout< >choice; switch(choice){ // swich choice case 1: createData(); break; case 2: { ifstream infile("data.txt"); // open the file if not opened show error if (!infile){ cout<<"Some error occured in opening file data.txt"< > temp){ arr[n++] = temp; } display(arr,n); break; } case 3: { ifstream infile("data.txt"); // open the file if not opened show error if (!infile){ cout<<"Some error occured in opening file data.txt"< > temp){ arr[n++] = temp; } int minimum = getMin(arr,MAX_SIZE); cout<<"Minimum value: "< > temp){ arr[n++] = temp; } infile.close(); int maximum = getMax(arr,MAX_SIZE); cout<<"Maximum value: "<
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started