please help!!!! i have a problem writing this program


this is the question for the program:
1) Query the user to find either the larger of 2 numbers or the largest of 3 numbers.

2) Use a ' switch ( ) ' structure to get the numbers to test in 2 'case' statements,

a) For finding the larger of 2 numbers, call the function 'larger (...)' and (See Function Fundamentals Item on this page);

b) For finding the largest of 3 numbers, call the function 'largest(...)'.

(See Function Fundamentals Item on this page)

3) Enclose the choices within a 'while' loop and exit the loop when the user signals 'exit' (you must define what the signal shall be).

4) Use the larger(...) and largest(...) functions defined in the 'functions fundamentals' item.






#include<iostream>
using namespace std;
double larger(double x, double y);
int main()
{
double one, two;

cout<<"the larger of 6 and 12 is"<<larger (6, 12)<<endl;
cout<<"enter two numbers: ";
cin>> one >> two;
cout<< endl;

cout<<"the larger of" << one << "and" << two <<"is" << larger (one, two) << endl;

return 0;
}

double larger (double x, double y)
{
double max;
switch (char y=12)
case 'a':
case 'A':
if(x>=y)
max=x;
else
break;

}

double larger ( double x, double y)
{
double max;
if (x>=y)
max=x;
else
max=y;
return max;
}




Topic archived. No new replies allowed.