Hlep please

I'm supposed to be creating a program that is menu driven and uses several user-defined functions, orverloaded functions and references..

upon program execution the screen will be cleared and the menu shown will appear on the screen again..

so far I have my entire program but for some reason when I'm selecting options for ex: I select 's' option and it works prompts me for my 2 float numbers but after I enter them my function for findSmallest() isn't working at all I get no results ..

if anyone can give me some incite or assistance on my program I will be greatly appreciative

Below is my program
--------------------------------------------------------------------------------


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

extern char menu(void);
extern void help(void);
extern void smallest(void);
extern float findSmallest(float fn1, float fn2);
extern void largest(void);
extern double findLargest(double dn1, double dn2);
extern void displayf(float& f, float& s, float& small);
extern void displayd(double&f, double& s, double& large);

int main(void)
{
float f1,f2;
double d1,d2;
char op;
while(1)
{
op = menu();
switch(op)
{
case 'h':
case 'H':
help();
break;
case 's':
case 'S':
smallest();
cin>>f1>>f2;
findSmallest(f1,f2);
break;
case 'l':
case 'L':
largest();
cin>>d1>>d2;
findLargest(d1,d2);
break;
}
}
return EXIT_SUCCESS;
}

extern char menu(void)
{
char menuOption;
int flag = 1;
while(flag == 1)
{
cout<<"\n\n Please Input the first intial of the menu option you desire\n\n";
cout << "\t h. Help\t s. Smallest\t l. Largest\t q. Quit\n\n\t";
cout << "\t\tPlease make your selection ==>";
cin >> menuOption;
switch(menuOption)
{
case 'h' :
case 'H' :
case 's' :
case 'S' :
case 'l' :
case 'L' :
flag = 0;
break;
case 'q' :
case 'Q' :
cout << "\n Finished, Program will now terminate..."<<endl;
exit(0);
default :
cout << "\n\t Wrong Choice, try again\n\n";
}
}

return menuOption;
}

extern void help(void)
{
cout << "\nChoosing the (H) option you have found the help menu\n"<<endl;
cout <<"this program is a simple menu driven program, which depending on the option you select"<<endl;
cout <<"The user has the options of find the smallest or largest number in a set"<<endl;
cout <<" of entered numbers by the user, in order to access these options the user must"<<endl;
cout <<"Input the first intial of the option they desire, after doing so you will be prompted"<<endl;
cout <<"to enter 2 numbers after doing so the largest or smallest of the two will be displayed"<<endl;
}

extern void smallest(void)
{
cout << "\nThis is the findSmallest menu, Please enter two float numbers\n"<<endl;

}

extern void largest(void)
{
cout << "\nThis is the findLargest menu, Please enter two double numbers\n"<<endl;
}

extern float findSmallest(float fn1, float fn2)
{
if (fn1 <= fn2)
{
return (fn1);
}
else
{
return (fn2);
}
}

extern double findLargest(double dn1, double dn2)// dn1= double number 1 dn2= double number 2
{
if (dn1 >=dn2)
{
return (dn1);
}
else
{
return (dn2);
}

}


extern void displayf(float resf)
{
cout << "\n The result is: " << setw(6) << resf << "\n\n";
}

extern void displayd(double resd)
{
cout << "\n The result is: " << setw(6) << resd << "\n\n";
}


Topic archived. No new replies allowed.