Patrick B. answered 04/17/20
Math and computer tutor/teacher
using namespace std;
#include <iostream>
#include <stdlib.h>
int Go()
{
int N;
int minVal;
int maxVal;
int iReturn=0;
int * A;
cout << " how many statistics in the list :>";
cin >> N;
A = (int *) malloc(N*sizeof(int));
if (A!=NULL)
{
for (int iLoop=0; iLoop<N; iLoop++)
{
cout << "Please input statistic # " << (iLoop+1) << ":>";
cin >> A[iLoop];
}
cout << "Please input the min Val :>";
cin >> minVal;
cout << "Please input the max val :>";
cin >> maxVal;
if (minVal>maxVal)
{
int temp = maxVal;
maxVal = temp;
temp = minVal;
}
for (int iLoop=0; iLoop<N; iLoop++)
{
if (
(A[iLoop]>=minVal) && (A[iLoop]=<maxVal)
)
{
cout << A[iLoop] << " ";
}
}
cout << endl;
free (A);
A=NULL;
}
else
{
iReturn = -1;
}
return(iReturn);
}
int main()
{
Go();
}