Math menu driven program problem.

Can not seem to get the program to perform the calculations within the cases. Also, how do you set up the a prime function program within the menu. Have been trying for five days 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
#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

void showChoices();
double prime(double, double);
double abs(double, double);
double pow(double, double);
double hypont(double, double);

int main()
{
	double x, y;
	int choice;
	do
	{
		showChoices();
		cin >> choice;
		switch (choice)
		{
		case 1:
			cout << "Enter one number: ";
			cin >> x ;
			cout << "prime numbers " << prime(x,y) <<endl;
			break;
		case 2:
			cout << "Enter one number: ";
			cin >>x ;
			cout << "The Absolute value is: " << abs(x) <<endl;
			break;
		case 3:
			cout << "Enter two numbers: ";
			cin >> x >> y;
			cout << "power " << pow(x,y) <<endl;
			break;
		case 4:
			cout << "Enter two numbers: ";
			cin >> x >> y;
			cout << "Hyptenuse " << hypont(x,y) <<endl;
			break;
		case 5:
			break;
		default:
			cout << "Invalid input" << endl;
		}
	}while (choice != 5);

	return 0;
}

void showChoices()
{
	cout << "MENU" << endl;
	cout << "1: Prime " << endl;
	cout << "2: Absolute value of a number" << endl;
	cout << "3: Compte X raised to the Y power " << endl;
	cout << "4: Hypotenuse Value " << endl;
	cout << "5: Quit the math program " << endl;
	cout << "Please enter a number (1-5):";
}

double prime(double a, double b)
{
	return a;
}

double abs(double a)
{
	return a;
}

double pow(double a, double b)
{

	return a;
   
}

double hypont(double a, double b)
{
	return a;
}
Can not seem to get the program to perform the calculations within the cases.

What behaviour are you seeing? How does it differ from the behaviour you're expecting?

Also, how do you set up the a prime function program within the menu.

Could you explain a bit more clearly what you mean by that?
Topic archived. No new replies allowed.