//Program No.
:H5.cpp
//Programmer
:Jorge Contreras
//Course/Sec
:ELET 2300/17244
//Instructor
:Dr. F. Attarzadeh
//Date Assigned
:October 10, 2013
//Date Modified
:N/A
//Due Date
:October 22, 2013
//Compiler
:Microsoft Visual C++. NET 2010
//Environment
:Console Application
//Operating System
:Windows XP, and Windows 7.


//Program No.
:H5.cpp
//Programmer
:Jorge Contreras
//Course/Sec
:ELET 2300/17244
//Instructor
:Dr. F. Attarzadeh
//Date Assigned
:October 10, 2013
//Date Modified
:N/A
//Due Date
:October 22, 2013
//Compiler
:Microsoft Visual C++. NET 2010
//Environment
:Console Application
//Operating System
:Windows XP, and Windows 7.
/*PROGRAM DESCRIPTION
The following is a menu-driven program. Within the program the user can choose:
-Help
-Smallest
-Largest
-Quit
if the user selects smallest then he/she will be prompted to enter the size of the array
they want to examine. Following that, the user will be prompted to input the values for
the actual elements within the array. A function findSmallest will be called which will
read and compute the users input and find the smallest value and the frequency of occurence.
The same procedure will be followed for Largest, except that the largest number will be found.
*/
#include
<iostream>
#include
<iomanip>
#include
<cstdlib>
using namespace
std;
//The following are function prototypes, which will be called upon.
extern void
help();
extern void
smallest();
extern int
sizeofArray();
extern double
getInputs();
extern double
findSmallest(
double
*s,
int
*f,
int
*size);
extern void
displays (
double
*
array
,
double
*s,
int
*f);
extern void
largest();
extern int
sizeofArrayy();
extern double
getInputss();
extern double
findLargest(
double
*s,
int
*f,
int
*size);
extern void
displayss (
double
*
array
,
double
*s,
int
*f);
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'
:
{
system (
"CLS"
);
smallest();
cout <<
"\t\t\t\t\t
"
;
system (
"PAUSE"
);
system (
"CLS"
);
break
;
}
case
'L'
:
case
'l'
:
{
system (
"CLS"
);
largest();
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 definition.
{
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"

<<


You've reached the end of your free preview.
Want to read all 14 pages?
- Fall '15
- Marinolent
- Return statement, Max, Void type, Jorge Contreras, //Operating System