Menu Based Function Calling

I don't really know how to connect my functions to user response, also, my menu isn't popping up. If anything else strikes the eye please tell me..
Doesn't say there are any errors but when I execute it's just black space.

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
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
void displayMenu();
void findSquareArea();
void findCircleArea();
void findTriangleArea();
const double pi = 3.14159;
int main()
{
void displayMenu();
char repeat = 'y';
do
{
void displayMenu();
int choice;
cin >> choice;
//These are the possible choices
if (choice == 1)
{
void findSquareArea();
} 
else if (choice == 2)
{
void findCircleArea();
} 
else if (choice == 3) 
{
void findTriangleArea();
}
else if (choice == 4)
{
	cout << "You have quit." << endl;
	repeat = 'n';
	break;
}
cout << "Press y if you would like to repeat." << endl;
cin >> repeat;
} while (repeat == 'y' || repeat == 'Y');
return 0;
}
void displayMenu()
{
cout << "Please select one of the following choices." << endl;
cout << "1 -- rectangle" << endl;
cout << "2 -- circle" << endl;
cout << "3 -- right_triangle" << endl;
cout << "4 -- quit" << endl;
}

void findSquareArea()
{
int length, width, area;
area = length * width;
	cout << "Please enter the length and width" << endl;
	cin >> length >> width;
	cout << "Your area is " << area << "." << endl;
} 
void findCircleArea()
{
int radius, area;
const double pi = 3.14159;
area = radius * radius * pi;
	cout << "Please enter the radius" << endl;
	cin >> radius;
	cout << "Your area is " << area << "." << endl;
} 
void findTriangleArea()
{
int width, height, area;
area = width * height / 2;
	cout << "Please enter the width and height." << endl;
	cin >> width >> height;
	cout << "Your area is " << width * height / 2 << "." << endl;
}

Last edited on
When you call a function you don't put the void there,
1
2
3
4
if (choice == 1)
{
    void findSquareArea();
} 


change to,

1
2
3
4
if (choice == 1)
{
    findSquareArea();
} 

Last edited on
I corrected that and the program compiles correctly, all I have is some sort of weird logic error that doesn't compute area correctly.
I entered 20 and 10 for square and got 0
an entry of 10 for radius gave a circumference of 2147483648.
Triangle works as intended,
at the end, if i enter n closes properly. If i enter y then nothing happens and if i continue to enter it an infinity loop is prompted
i managed to fix it
Topic archived. No new replies allowed.