using arrays and pointers to find smallest and largest

Ok so i am new to c++, Please help with the following code.

OK SO THIS ARE THE INSTRUCTIONS I NEED TO FOLLOW FOR A SPECIFIC PART OF THE PROGRAM WHICH IS TO FIND THE SMALLEST.

S or s ( for Smallest ) option will invoke a function named smallest( ) which will prompt the user for the number of elements of a double type array to be examined. The program will use a function named sizeOfArray( ), which will read the keyboard, and then returns the number of elements, followed by another prompt to get the actual elements, using the function getInputs( ). The program will then call a function named findSmallest( ) which will compute and return the smallest number in the set, and its frequency of occurrence. The program will then display the array elements, the smallest number, and its frequency of occurrence using a function named display( ), in the format shown below, in the middle of the screen. The output shown is for an array of six elements with an array identifier a.
a[0] = xxxx.xx
a[1] = xxxx.xx
a[2] = xxxx.xx
a[3] = xxxx.xx
a[4] = xxxx.xx
a[5] = xxxx.xx
Smallest no. = xxxx.xx Frequency = xx
The function prototypes to be used are as follows:
void smallest(void);
double findSmallest(double *s, int* f, int* size);
here, s is the base of the array, f is the pointer to the frequency of occurrence, and size is the pointer carrying the current size of the array.
int sizeOfArray(void);
double getInputs(void);
void display(double *array, double* s, int* f);

THIS IS MY CODE SO FAR, PLEASE HELP ME FIGURE OUT HOW TO FIND THE SMALLEST

#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;

//The following are function prototypes, which will be called upon.
void help();
void smallest();
int sizeOfArray;

int main ()
{
while (1)//The loop begins.
{
char option;
cout << "\t\tHelp\t\tSmallest";
cout << "\tLargest\t\tQuit";
cout << "\n\nPlease type the first letter of a choice to begin ==> ";
cin >> option;

switch (option)
{
case 'H':
case 'h':
{
system ("CLS");
help (); //Calls the help () function.
cout << "\t\t\t\t\t "; //This allows for the "Strike any key to continue..." to go to the right side of the screen.
system ("PAUSE");
system ("CLS");
break;
}

case 'S':
case 's':
{
int numElements;
int i = 0;
system ("CLS");
smallest();
cin >> numElements;
for (i = 0; i < numElements; i++)
sizeOfArray ();
cout << "\t\t\t\t\t ";
system ("PAUSE");
system ("CLS");
break;
}
case 'L':
case 'l':
{
system ("CLS");
cout << "\t\t\t\t\t ";
system ("PAUSE");
system ("CLS");
break;
}
case 'Q':
case 'q':
cout << "\nThis program is now terminated, Press any key to exit.\n" << endl;
cout << "\t\t\t\t\t ";
exit (0);
default: // Warns the User of invalid choices.
system ("CLS");
cout << "\nNot a valid choice, H or h, S or s, L or l, and Q or q are\n"
<< "the only letters allowed\n";
cout << "\t\t\t\t\t ";
system ("PAUSE");
system ("CLS");
}
}
return 0;
}
void help () //Function help is developed.
{
cout << "\t\t\tHelp" << endl;
cout << "\n\nThis is the Help screen. You have up to four choices"
<< "\nin this program. These choices are as follow:\n" << endl;
cout << "::Help::\nThe help option welcomes you and helps you work"
<< " the program out.\n";
cout << "\n::Smallest::\nWithin this option the user will be prompted"
<< " for the number of elements to be examined, then the user will"
<< " be promted to input the actual elements. Finally a function will"
<< " compute and return the smallest number in the set, and its"
<< " frequency of occurrence.\n" << endl;
cout << "::Largest::\nWithin this option the user will be prompted"
<< " for the number of elements to be examined, then the user will"
<< " be promted to input the actual elements. Finally a function will"
<< " compute and return the largest number in the set, and its"
<< " frequency of occurrence.\n" << endl;
cout << "::Quit::\nThis option will allow the user to terminate the program"
<< "\nafter pressing any key...\n" << endl;
cout << "\n*Any other letter besides the ones in front of the options will"
<< "\nnot be executed properly and a warning message will appear.\n" << endl;
return;
}
void smallest()
{
cout << "\t\tSmallest Number";
cout << "Please input the number of elements you want to examine ==> ";
return;
}
int sizeOfArray (void)
{
int* i, a;
cout << "enter value number ["<<i<<"] ";
cin >> a[i];
return;
}
Topic archived. No new replies allowed.