Question: / / name: your full name / / date: 2 - 1 4 - 2 0 2 4 / / description: chapter 9 assignments #include

// name: your full name
// date: 2-14-2024
// description: chapter9 assignments
#include
#include "input.h"
using namespace std;
// prototype
void challenge3();
int main()
{
do
{
system("cls");
cout <<"
\tCMPR121: Chapter 9 Pointer - assignments by Prof Q (2-14-2024)";
cout <<"
\t"<< string(80, char(205));
cout <<"
\t 3. Drop the Lowest Score";
cout <<"
\t 6. Case Study Modification #1";
cout <<"
\t 7. Case Study Modification #2";
cout <<"
\t 9. Median Function";
cout <<"
\t10. Reverse Array";
cout <<"
\t11. Array Expander";
cout <<"
\t12. Element Shifter";
cout <<"
\t"<< string(80, char(196));
cout <<"
\t 0. Exit";
cout <<"
\t"<< string(80, char(205));
cout <<"
";
switch (inputInteger("\tOption: ",0,12))
{
case 0: exit(0);
case 3: challenge3(); break;
// case 6: challenge6(); break;
// case 7: challenge7(); break;
// case 9: challenge9(); break;
// case 10: challenge10(); break;
// case 11: challenge11(); break;
// case 12: challenge12(); break;
default: cout <<"
\tERROR: Invalid option.
";
}
system("pause");
} while (true);
return 0;
}
void challenge3()
{
int size = inputInteger("
Enter the size of the dynamic array: ", true);
double* scores = new double[size];
srand(time(0));
int sum =0;
for (int i =0; i < size; i++)
{
*(scores+i)= rand()%100+1;
cout <<*(scores + i)<<'
';
sum +=*(scores + i);
}
//no ascending order sort
//not eliminate the lowest score from the array
cout <<"
Average: "<< static_cast(sum)/size <<'
';
delete[] scores;
}

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!