Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

int main ( ) { do { system ( cls ) ; cout < < tCMPR 1 2 1 : Chapter

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

ISBN: 0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago