arrays inside functions

hello, I am having a hard time completing an assignment in class. pretty much its arrays inside functions. I have a basic understanding of arrays, however my teacher never explained how to use them in the way he wants in the homework and honestly I don't even really know how to start the program. I can program all the way up to the menu then I have no idea what to do. I will post the assignement he gave us and when I get back to the program I will post it. any help on simplyfing it down for me is greatly appreciated (ps im not looking for someone to do it for me, Im looking for someone to help me do it)

what he gave us:

Upon program execution, the screen will be cleared and the menu shown above will appear at the top of the screen and centered. The menu items are explained below.
Help Smallest Largest Quit
H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user how to interact with the program, type of data to be entered, and what results would the program produce. Each help screen should remain on the monitor until the user strikes any key. Once the user's input is processed, the screen will be cleared and the menu is displayed again.
S or s ( for Smallest ) option will invoke a function named smallest( ) which will prompt the user for the number of elements of an array of type double 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 array, 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. Your array will be different.
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 array, f is the frequency of occurrence, and size is the current size of the array.
int sizeOfArray(void);
double getInputs(void);
void display(double array[], double ss, int& freq, int size);
The results should stay on the screen with the following prompt which will appear on the lower right hand corner of the screen:
Strike any key to continue...

ill post what I have probably tomorrow! ( the other half of this assignment is a to find the largest. how ever its relatively the same.) please help!!

#include <iostream>
using namespace std;

void help(void);
void smallest(void);
double findSmallest(double s[],int& f, int size);
int sizeOfArray(void);
double getInputs(void);
void display(double array [], double ss, int& freq, int size);

int main()
{
char menu;
int flag =1;
while(flag == 1)
{

cout << "Help Smallest Largest Quit\n:";
cin >> menu;

switch(menu)
{
case 'h':
case 'H':
help();
break;
case 's':
case 'S':
smallest();
break;
case 'l':
case 'L':
break;
case 'q':
case 'Q':
flag = 0;
cout << "program terminated upon user request\n";
break;
default:
cout << "Wrong choice\n\nPlease make another selection\n";
}
}
return 0;
}

void help(void)
{
cout <<"if the user selects s the program will take the smallest of two numbers";
cout <<"if the user selects l the program will take the largest of two numbers";
cout <<"if q is chosen the program will quit\n";

return;
}

void smallest(void)
{
const int arraysize = 100;
double x[arraysize];
int y, z;
cout << "how many elements are in the array??";
sizeOfArray();
getInputs();
findSmallest(x, y, z);
}

int sizeOfArray(void)
{
int element;
cin >> element;

return element;
}

double getInputs(void)
{

cout << " input numbers and press . when you are done";
int a;
while(a!= '.')
{
cin >> a;
}

return a;
}

double findSmallest(double s[], int& f, int size)
{

}

void display(double array[], double ss, int& freq, int size)
{

}


this is the code i got so far! i dont know where to go from here or if this is even remotley correct.
update:
please help im lost!!!
i have progressed farther ignoring some of the teachers instructions. however know when i execute the program i get a pop up (when choosing smallest) that reads:

debug error!

program: ...wweathe\documents\visual studio
2010\projects\h6\debug\h6.exe
module: ... wweahte\documents\visual studio
2010/projects/h6\debug\h6.exe
file:

run-time check failure #3 - the variable "values" is being used without being initialized.

abort retry ignore

this is my code as of now:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <iostream>
#include <algorithm>
using namespace std;

void help(void);
void smallest(void);
double getInputs(void);


int main()
{
	char menu;
	int flag =1;
	while(flag == 1)
	{
	
	cout << "Help	Smallest	Largest		Quit\n:";
	cin >> menu;

		switch(menu)
		{
		case 'h':
		case 'H':
		help();
		break;
		case 's':
		case 'S':
			smallest();
			break;
		case 'l':
		case 'L':
			break;
		case 'q':
		case 'Q':
		flag = 0;
		cout << "program terminated upon user request\n";
		break;
		default:
		cout << "Wrong choice\n\nPlease make another selection\n";
		}
	}
	return 0;
}

void help(void)
{
	cout <<"if the user selects s the program will take the smallest of the numbers entered";
	cout <<"if the user selects l the program will take the largest of the numbers entered";
	cout <<"if q is chosen the program will quit\n";

	return;
}
		
void smallest(void)
{
	getInputs();
}

double getInputs(void)
{
	const int x = 8;
	int values[x];
	int small;

	while(values[x] != 'q' )
	{
	for ( int i = 0; i < 9; i++ )
		{
			cout << " enter a value " << i << ":";
			cin >> values[i];
		}

	small=values[0];
	}

	for ( int i = 0; i < 9; i ++)
	{ 
		if(values[i] < small)
		{
			small = values[i];
		}
	}

	cout << " The smallest number is " << small << endl;

	return 0;

}

Topic archived. No new replies allowed.